gpiolib-sysfs.c (4f2c0a4acffbec01079c28f839422e64ddeff004) | gpiolib-sysfs.c (d74e316633e49f44756c23997fa071979a939405) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/idr.h> 3#include <linux/mutex.h> 4#include <linux/device.h> 5#include <linux/sysfs.h> 6#include <linux/gpio/consumer.h> 7#include <linux/gpio/driver.h> 8#include <linux/interrupt.h> --- 477 unchanged lines hidden (view full) --- 486 struct gpio_desc *desc; 487 int status; 488 489 status = kstrtol(buf, 0, &gpio); 490 if (status < 0) 491 goto done; 492 493 desc = gpio_to_desc(gpio); | 1// SPDX-License-Identifier: GPL-2.0 2#include <linux/idr.h> 3#include <linux/mutex.h> 4#include <linux/device.h> 5#include <linux/sysfs.h> 6#include <linux/gpio/consumer.h> 7#include <linux/gpio/driver.h> 8#include <linux/interrupt.h> --- 477 unchanged lines hidden (view full) --- 486 struct gpio_desc *desc; 487 int status; 488 489 status = kstrtol(buf, 0, &gpio); 490 if (status < 0) 491 goto done; 492 493 desc = gpio_to_desc(gpio); |
494 /* reject bogus commands (gpio_unexport ignores them) */ | 494 /* reject bogus commands (gpiod_unexport() ignores them) */ |
495 if (!desc) { 496 pr_warn("%s: invalid GPIO %ld\n", __func__, gpio); 497 return -EINVAL; 498 } 499 500 status = -EINVAL; 501 502 /* No extra locking here; FLAG_SYSFS just signifies that the --- 282 unchanged lines hidden (view full) --- 785 status = class_register(&gpio_class); 786 if (status < 0) 787 return status; 788 789 /* Scan and register the gpio_chips which registered very 790 * early (e.g. before the class_register above was called). 791 * 792 * We run before arch_initcall() so chip->dev nodes can have | 495 if (!desc) { 496 pr_warn("%s: invalid GPIO %ld\n", __func__, gpio); 497 return -EINVAL; 498 } 499 500 status = -EINVAL; 501 502 /* No extra locking here; FLAG_SYSFS just signifies that the --- 282 unchanged lines hidden (view full) --- 785 status = class_register(&gpio_class); 786 if (status < 0) 787 return status; 788 789 /* Scan and register the gpio_chips which registered very 790 * early (e.g. before the class_register above was called). 791 * 792 * We run before arch_initcall() so chip->dev nodes can have |
793 * registered, and so arch_initcall() can always gpio_export(). | 793 * registered, and so arch_initcall() can always gpiod_export(). |
794 */ 795 spin_lock_irqsave(&gpio_lock, flags); 796 list_for_each_entry(gdev, &gpio_devices, list) { 797 if (gdev->mockdev) 798 continue; 799 800 /* 801 * TODO we yield gpio_lock here because --- 16 unchanged lines hidden --- | 794 */ 795 spin_lock_irqsave(&gpio_lock, flags); 796 list_for_each_entry(gdev, &gpio_devices, list) { 797 if (gdev->mockdev) 798 continue; 799 800 /* 801 * TODO we yield gpio_lock here because --- 16 unchanged lines hidden --- |