aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib-sysfs.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2015-05-04 11:10:38 -0400
committerLinus Walleij <linus.walleij@linaro.org>2015-05-12 04:47:16 -0400
commit0f62850808b9ad14e933a68bd11d7c41f1930dfe (patch)
tree2d4e414ecd72c504f87af173849f62dd3436ae6b /drivers/gpio/gpiolib-sysfs.c
parentc43960fbcc514b0ec8169a66ba9955608e6775a7 (diff)
gpio: sysfs: remove redundant gpio-descriptor parameters
Remove redundant gpio-descriptor parameters from sysfs_set_active_low and gpio_setup_irq. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-sysfs.c')
-rw-r--r--drivers/gpio/gpiolib-sysfs.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 097e7e539c9d..0bc959fbcf23 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -133,9 +133,10 @@ static irqreturn_t gpio_sysfs_irq(int irq, void *priv)
133 return IRQ_HANDLED; 133 return IRQ_HANDLED;
134} 134}
135 135
136static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev, 136static int gpio_setup_irq(struct device *dev, unsigned long gpio_flags)
137 unsigned long gpio_flags)
138{ 137{
138 struct gpiod_data *data = dev_get_drvdata(dev);
139 struct gpio_desc *desc = data->desc;
139 struct kernfs_node *value_sd; 140 struct kernfs_node *value_sd;
140 unsigned long irq_flags; 141 unsigned long irq_flags;
141 int ret, irq, id; 142 int ret, irq, id;
@@ -257,8 +258,6 @@ static ssize_t edge_show(struct device *dev,
257static ssize_t edge_store(struct device *dev, 258static ssize_t edge_store(struct device *dev,
258 struct device_attribute *attr, const char *buf, size_t size) 259 struct device_attribute *attr, const char *buf, size_t size)
259{ 260{
260 struct gpiod_data *data = dev_get_drvdata(dev);
261 struct gpio_desc *desc = data->desc;
262 ssize_t status; 261 ssize_t status;
263 int i; 262 int i;
264 263
@@ -270,7 +269,7 @@ static ssize_t edge_store(struct device *dev,
270found: 269found:
271 mutex_lock(&sysfs_lock); 270 mutex_lock(&sysfs_lock);
272 271
273 status = gpio_setup_irq(desc, dev, trigger_types[i].flags); 272 status = gpio_setup_irq(dev, trigger_types[i].flags);
274 if (!status) 273 if (!status)
275 status = size; 274 status = size;
276 275
@@ -280,9 +279,10 @@ found:
280} 279}
281static DEVICE_ATTR_RW(edge); 280static DEVICE_ATTR_RW(edge);
282 281
283static int sysfs_set_active_low(struct gpio_desc *desc, struct device *dev, 282static int sysfs_set_active_low(struct device *dev, int value)
284 int value)
285{ 283{
284 struct gpiod_data *data = dev_get_drvdata(dev);
285 struct gpio_desc *desc = data->desc;
286 int status = 0; 286 int status = 0;
287 287
288 if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value) 288 if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value)
@@ -298,8 +298,8 @@ static int sysfs_set_active_low(struct gpio_desc *desc, struct device *dev,
298 !!test_bit(FLAG_TRIG_FALL, &desc->flags)) { 298 !!test_bit(FLAG_TRIG_FALL, &desc->flags)) {
299 unsigned long trigger_flags = desc->flags & GPIO_TRIGGER_MASK; 299 unsigned long trigger_flags = desc->flags & GPIO_TRIGGER_MASK;
300 300
301 gpio_setup_irq(desc, dev, 0); 301 gpio_setup_irq(dev, 0);
302 status = gpio_setup_irq(desc, dev, trigger_flags); 302 status = gpio_setup_irq(dev, trigger_flags);
303 } 303 }
304 304
305 return status; 305 return status;
@@ -325,8 +325,6 @@ static ssize_t active_low_show(struct device *dev,
325static ssize_t active_low_store(struct device *dev, 325static ssize_t active_low_store(struct device *dev,
326 struct device_attribute *attr, const char *buf, size_t size) 326 struct device_attribute *attr, const char *buf, size_t size)
327{ 327{
328 struct gpiod_data *data = dev_get_drvdata(dev);
329 struct gpio_desc *desc = data->desc;
330 ssize_t status; 328 ssize_t status;
331 long value; 329 long value;
332 330
@@ -334,7 +332,7 @@ static ssize_t active_low_store(struct device *dev,
334 332
335 status = kstrtol(buf, 0, &value); 333 status = kstrtol(buf, 0, &value);
336 if (status == 0) 334 if (status == 0)
337 status = sysfs_set_active_low(desc, dev, value != 0); 335 status = sysfs_set_active_low(dev, value != 0);
338 336
339 mutex_unlock(&sysfs_lock); 337 mutex_unlock(&sysfs_lock);
340 338
@@ -710,7 +708,7 @@ void gpiod_unexport(struct gpio_desc *desc)
710 * Release irq after deregistration to prevent race with 708 * Release irq after deregistration to prevent race with
711 * edge_store. 709 * edge_store.
712 */ 710 */
713 gpio_setup_irq(desc, dev, 0); 711 gpio_setup_irq(dev, 0);
714 put_device(dev); 712 put_device(dev);
715 kfree(data); 713 kfree(data);
716 } 714 }