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

[media] mt9p031: Use bulk regulator API

The sensor is powered by three supplies. Use the bulk regulator API to
enable and disable them instead of performing the operations manually.
This fixes a warning caused by ignoring the return value of
regulator_enable().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
7997196c 8d4da37c

+15 -15
+15 -15
drivers/media/i2c/mt9p031.c
··· 125 125 int power_count; 126 126 127 127 struct clk *clk; 128 - struct regulator *vaa; 129 - struct regulator *vdd; 130 - struct regulator *vdd_io; 128 + struct regulator_bulk_data regulators[3]; 131 129 132 130 enum mt9p031_model model; 133 131 struct aptina_pll pll; ··· 270 272 271 273 static int mt9p031_power_on(struct mt9p031 *mt9p031) 272 274 { 275 + int ret; 276 + 273 277 /* Ensure RESET_BAR is low */ 274 278 if (gpio_is_valid(mt9p031->reset)) { 275 279 gpio_set_value(mt9p031->reset, 0); ··· 279 279 } 280 280 281 281 /* Bring up the supplies */ 282 - regulator_enable(mt9p031->vdd); 283 - regulator_enable(mt9p031->vdd_io); 284 - regulator_enable(mt9p031->vaa); 282 + ret = regulator_bulk_enable(ARRAY_SIZE(mt9p031->regulators), 283 + mt9p031->regulators); 284 + if (ret < 0) 285 + return ret; 285 286 286 287 /* Emable clock */ 287 288 if (mt9p031->clk) ··· 304 303 usleep_range(1000, 2000); 305 304 } 306 305 307 - regulator_disable(mt9p031->vaa); 308 - regulator_disable(mt9p031->vdd_io); 309 - regulator_disable(mt9p031->vdd); 306 + regulator_bulk_disable(ARRAY_SIZE(mt9p031->regulators), 307 + mt9p031->regulators); 310 308 311 309 if (mt9p031->clk) 312 310 clk_disable_unprepare(mt9p031->clk); ··· 985 985 mt9p031->model = did->driver_data; 986 986 mt9p031->reset = -1; 987 987 988 - mt9p031->vaa = devm_regulator_get(&client->dev, "vaa"); 989 - mt9p031->vdd = devm_regulator_get(&client->dev, "vdd"); 990 - mt9p031->vdd_io = devm_regulator_get(&client->dev, "vdd_io"); 988 + mt9p031->regulators[0].supply = "vdd"; 989 + mt9p031->regulators[1].supply = "vdd_io"; 990 + mt9p031->regulators[2].supply = "vaa"; 991 991 992 - if (IS_ERR(mt9p031->vaa) || IS_ERR(mt9p031->vdd) || 993 - IS_ERR(mt9p031->vdd_io)) { 992 + ret = devm_regulator_bulk_get(&client->dev, 3, mt9p031->regulators); 993 + if (ret < 0) { 994 994 dev_err(&client->dev, "Unable to get regulators\n"); 995 - return -ENODEV; 995 + return ret; 996 996 } 997 997 998 998 v4l2_ctrl_handler_init(&mt9p031->ctrls, ARRAY_SIZE(mt9p031_ctrls) + 6);