1 From d3f188f38eaa34acf6375d5d88fe27971aae1170 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Fri, 21 Dec 2012 20:34:06 +0100
4 Subject: [PATCH 4/6] mt9p031: Use devm_* managed helpers
6 Replace kzalloc and gpio_request_one by their managed equivalents.
8 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 drivers/media/i2c/mt9p031.c | 13 +++----------
11 1 file changed, 3 insertions(+), 10 deletions(-)
13 diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
14 index e328332..e0bad59 100644
15 --- a/drivers/media/i2c/mt9p031.c
16 +++ b/drivers/media/i2c/mt9p031.c
17 @@ -927,7 +927,7 @@ static int mt9p031_probe(struct i2c_client *client,
21 - mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL);
22 + mt9p031 = devm_kzalloc(&client->dev, sizeof(*mt9p031), GFP_KERNEL);
26 @@ -1001,8 +1001,8 @@ static int mt9p031_probe(struct i2c_client *client,
27 mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB;
29 if (pdata->reset != -1) {
30 - ret = gpio_request_one(pdata->reset, GPIOF_OUT_INIT_LOW,
32 + ret = devm_gpio_request_one(&client->dev, pdata->reset,
33 + GPIOF_OUT_INIT_LOW, "mt9p031_rst");
37 @@ -1013,12 +1013,8 @@ static int mt9p031_probe(struct i2c_client *client,
41 - if (mt9p031->reset != -1)
42 - gpio_free(mt9p031->reset);
44 v4l2_ctrl_handler_free(&mt9p031->ctrls);
45 media_entity_cleanup(&mt9p031->subdev.entity);
50 @@ -1032,9 +1028,6 @@ static int mt9p031_remove(struct i2c_client *client)
51 v4l2_ctrl_handler_free(&mt9p031->ctrls);
52 v4l2_device_unregister_subdev(subdev);
53 media_entity_cleanup(&subdev->entity);
54 - if (mt9p031->reset != -1)
55 - gpio_free(mt9p031->reset);