diff options
Diffstat (limited to 'drivers/input/rmi4/rmi_smbus.c')
-rw-r--r-- | drivers/input/rmi4/rmi_smbus.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c index 83b1467bb6bf..225025a0940c 100644 --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -53,6 +53,7 @@ static int rmi_smb_get_version(struct rmi_smb_xport *rmi_smb) dev_err(&client->dev, "failed to get SMBus version number!\n"); return retval; } + return retval + 1; } @@ -275,19 +276,24 @@ static int rmi_smb_probe(struct i2c_client *client, { struct rmi_device_platform_data *pdata = dev_get_platdata(&client->dev); struct rmi_smb_xport *rmi_smb; - int retval; int smbus_version; + int error; + + if (!pdata) { + dev_err(&client->dev, "no platform data, aborting\n"); + return -ENOMEM; + } if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_HOST_NOTIFY)) { dev_err(&client->dev, - "adapter does not support required functionality.\n"); + "adapter does not support required functionality\n"); return -ENODEV; } if (client->irq <= 0) { - dev_err(&client->dev, "no IRQ provided, giving up.\n"); + dev_err(&client->dev, "no IRQ provided, giving up\n"); return client->irq ? client->irq : -ENODEV; } @@ -296,12 +302,7 @@ static int rmi_smb_probe(struct i2c_client *client, if (!rmi_smb) return -ENOMEM; - if (!pdata) { - dev_err(&client->dev, "no platform data, aborting\n"); - return -ENOMEM; - } - - rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Probing %s.\n", + rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Probing %s\n", dev_name(&client->dev)); rmi_smb->client = client; @@ -314,34 +315,30 @@ static int rmi_smb_probe(struct i2c_client *client, rmi_smb->xport.proto_name = "smb2"; rmi_smb->xport.ops = &rmi_smb_ops; - retval = rmi_smb_get_version(rmi_smb); - if (retval < 0) - return retval; + smbus_version = rmi_smb_get_version(rmi_smb); + if (smbus_version < 0) + return smbus_version; - smbus_version = retval; rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Smbus version is %d", smbus_version); if (smbus_version != 2) { - dev_err(&client->dev, "Unrecognized SMB version %d.\n", + dev_err(&client->dev, "Unrecognized SMB version %d\n", smbus_version); return -ENODEV; } i2c_set_clientdata(client, rmi_smb); - retval = rmi_register_transport_device(&rmi_smb->xport); - if (retval) { - dev_err(&client->dev, "Failed to register transport driver at 0x%.2X.\n", - client->addr); - i2c_set_clientdata(client, NULL); - return retval; + dev_info(&client->dev, "registering SMbus-connected sensor\n"); + + error = rmi_register_transport_device(&rmi_smb->xport); + if (error) { + dev_err(&client->dev, "failed to register sensor: %d\n", error); + return error; } - dev_info(&client->dev, "registered rmi smb driver at %#04x.\n", - client->addr); return 0; - } static int rmi_smb_remove(struct i2c_client *client) |