summaryrefslogtreecommitdiff
path: root/patches.tizen/1263-usb-misc-usb3503-Convert-to-devm_-APIs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches.tizen/1263-usb-misc-usb3503-Convert-to-devm_-APIs.patch')
-rw-r--r--patches.tizen/1263-usb-misc-usb3503-Convert-to-devm_-APIs.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/patches.tizen/1263-usb-misc-usb3503-Convert-to-devm_-APIs.patch b/patches.tizen/1263-usb-misc-usb3503-Convert-to-devm_-APIs.patch
new file mode 100644
index 00000000000..a7e110cbce5
--- /dev/null
+++ b/patches.tizen/1263-usb-misc-usb3503-Convert-to-devm_-APIs.patch
@@ -0,0 +1,118 @@
+From 5c22ceef0dc5fb40da47ca6b4d645adcbdabbe69 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@linaro.org>
+Date: Wed, 7 Aug 2013 22:02:54 +0100
+Subject: [PATCH 1263/1302] usb: misc: usb3503: Convert to devm_ APIs
+
+Saves us a bit of code.
+
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[mszyprow: mainline commit cffedd6794bb32c4fbc03600fac61beca7950f08]
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Change-Id: Icffedd6794bb32c4fbc03600fac61beca7950f08
+
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+---
+ drivers/usb/misc/usb3503.c | 42 +++++++-----------------------------------
+ 1 file changed, 7 insertions(+), 35 deletions(-)
+
+diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
+index 4e3a2d2..41b4228 100644
+--- a/drivers/usb/misc/usb3503.c
++++ b/drivers/usb/misc/usb3503.c
+@@ -187,7 +187,7 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
+ const u32 *property;
+ int len;
+
+- hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL);
++ hub = devm_kzalloc(&i2c->dev, sizeof(struct usb3503), GFP_KERNEL);
+ if (!hub) {
+ dev_err(&i2c->dev, "private data alloc fail\n");
+ return err;
+@@ -229,35 +229,35 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
+ }
+
+ if (gpio_is_valid(hub->gpio_intn)) {
+- err = gpio_request_one(hub->gpio_intn,
++ err = devm_gpio_request_one(&i2c->dev, hub->gpio_intn,
+ GPIOF_OUT_INIT_HIGH, "usb3503 intn");
+ if (err) {
+ dev_err(&i2c->dev,
+ "unable to request GPIO %d as connect pin (%d)\n",
+ hub->gpio_intn, err);
+- goto err_out;
++ return err;
+ }
+ }
+
+ if (gpio_is_valid(hub->gpio_connect)) {
+- err = gpio_request_one(hub->gpio_connect,
++ err = devm_gpio_request_one(&i2c->dev, hub->gpio_connect,
+ GPIOF_OUT_INIT_HIGH, "usb3503 connect");
+ if (err) {
+ dev_err(&i2c->dev,
+ "unable to request GPIO %d as connect pin (%d)\n",
+ hub->gpio_connect, err);
+- goto err_gpio_connect;
++ return err;
+ }
+ }
+
+ if (gpio_is_valid(hub->gpio_reset)) {
+- err = gpio_request_one(hub->gpio_reset,
++ err = devm_gpio_request_one(&i2c->dev, hub->gpio_reset,
+ GPIOF_OUT_INIT_LOW, "usb3503 reset");
+ if (err) {
+ dev_err(&i2c->dev,
+ "unable to request GPIO %d as reset pin (%d)\n",
+ hub->gpio_reset, err);
+- goto err_gpio_reset;
++ return err;
+ }
+ }
+
+@@ -267,33 +267,6 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
+ (hub->mode == USB3503_MODE_HUB) ? "hub" : "standby");
+
+ return 0;
+-
+-err_gpio_reset:
+- if (gpio_is_valid(hub->gpio_connect))
+- gpio_free(hub->gpio_connect);
+-err_gpio_connect:
+- if (gpio_is_valid(hub->gpio_intn))
+- gpio_free(hub->gpio_intn);
+-err_out:
+- kfree(hub);
+-
+- return err;
+-}
+-
+-static int usb3503_remove(struct i2c_client *i2c)
+-{
+- struct usb3503 *hub = i2c_get_clientdata(i2c);
+-
+- if (gpio_is_valid(hub->gpio_intn))
+- gpio_free(hub->gpio_intn);
+- if (gpio_is_valid(hub->gpio_connect))
+- gpio_free(hub->gpio_connect);
+- if (gpio_is_valid(hub->gpio_reset))
+- gpio_free(hub->gpio_reset);
+-
+- kfree(hub);
+-
+- return 0;
+ }
+
+ static const struct i2c_device_id usb3503_id[] = {
+@@ -316,7 +289,6 @@ static struct i2c_driver usb3503_driver = {
+ .of_match_table = of_match_ptr(usb3503_of_match),
+ },
+ .probe = usb3503_probe,
+- .remove = usb3503_remove,
+ .id_table = usb3503_id,
+ };
+
+--
+1.8.3.2
+