Skip to content

Commit

Permalink
lp8727_charger: Add supported i2c functionality check routine
Browse files Browse the repository at this point in the history
lp8727 i2c r/w functions are based on SMBUS I2C BLOCK. So the driver needs to
check whether i2c bus supports this functionality or not.

Signed-off-by: Woogyom Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
  • Loading branch information
Kim, Milo authored and Anton Vorontsov committed Jan 4, 2012
1 parent 2165c8a commit 998a8e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/power/lp8727_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
struct lp8727_chg *pchg;
int ret;

if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
return -EIO;

pchg = kzalloc(sizeof(*pchg), GFP_KERNEL);
if (!pchg)
return -ENOMEM;
Expand Down

0 comments on commit 998a8e7

Please sign in to comment.