Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: light: vcnl4000: move power enablement from init to probe

Given both vcnl4000_init() and vcnl4200_init() end with
dev->chip_spec->set_power_state(), they can be called once from the
probe to enable the sensors. Move the set_power_state function from init
and call it after init function in probe.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Erikas Bitovtas and committed by
Jonathan Cameron
1c9cb535 7e1d6b37

+5 -5
+5 -5
drivers/iio/light/vcnl4000.c
··· 280 280 data->rev = ret & 0xf; 281 281 data->al_scale = 250000; 282 282 283 - return data->chip_spec->set_power_state(data, true); 283 + return 0; 284 284 }; 285 285 286 286 static ssize_t vcnl4000_write_als_enable(struct vcnl4000_data *data, bool en) ··· 422 422 regval = ret | VCNL4040_CONF3_PS_SAMPLE_16BITS; 423 423 ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF3, 424 424 regval); 425 - if (ret < 0) 426 - return ret; 427 - 428 - ret = data->chip_spec->set_power_state(data, true); 429 425 if (ret < 0) 430 426 return ret; 431 427 ··· 1997 2001 1998 2002 ret = data->chip_spec->init(data); 1999 2003 if (ret < 0) 2004 + return ret; 2005 + 2006 + ret = data->chip_spec->set_power_state(data, true); 2007 + if (ret) 2000 2008 return ret; 2001 2009 2002 2010 dev_dbg(&client->dev, "%s Ambient light/proximity sensor, Rev: %02x\n",