Commit f4e14d45 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

gpio: cdev: replace gpiochip_get_desc() with gpio_device_get_desc()

gpio_device_get_desc() is the safer alternative to gpiochip_get_desc().
As we don't really need to dereference the chip pointer to retrieve the
descriptors in character device code, let's use it.
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent b93bca4b
...@@ -332,7 +332,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip) ...@@ -332,7 +332,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
/* Request each GPIO */ /* Request each GPIO */
for (i = 0; i < handlereq.lines; i++) { for (i = 0; i < handlereq.lines; i++) {
u32 offset = handlereq.lineoffsets[i]; u32 offset = handlereq.lineoffsets[i];
struct gpio_desc *desc = gpiochip_get_desc(gdev->chip, offset); struct gpio_desc *desc = gpio_device_get_desc(gdev, offset);
if (IS_ERR(desc)) { if (IS_ERR(desc)) {
ret = PTR_ERR(desc); ret = PTR_ERR(desc);
...@@ -1739,7 +1739,7 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip) ...@@ -1739,7 +1739,7 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
/* Request each GPIO */ /* Request each GPIO */
for (i = 0; i < ulr.num_lines; i++) { for (i = 0; i < ulr.num_lines; i++) {
u32 offset = ulr.offsets[i]; u32 offset = ulr.offsets[i];
struct gpio_desc *desc = gpiochip_get_desc(gdev->chip, offset); struct gpio_desc *desc = gpio_device_get_desc(gdev, offset);
if (IS_ERR(desc)) { if (IS_ERR(desc)) {
ret = PTR_ERR(desc); ret = PTR_ERR(desc);
...@@ -2123,7 +2123,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) ...@@ -2123,7 +2123,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
lflags = eventreq.handleflags; lflags = eventreq.handleflags;
eflags = eventreq.eventflags; eflags = eventreq.eventflags;
desc = gpiochip_get_desc(gdev->chip, offset); desc = gpio_device_get_desc(gdev, offset);
if (IS_ERR(desc)) if (IS_ERR(desc))
return PTR_ERR(desc); return PTR_ERR(desc);
...@@ -2419,7 +2419,7 @@ static int lineinfo_get_v1(struct gpio_chardev_data *cdev, void __user *ip, ...@@ -2419,7 +2419,7 @@ static int lineinfo_get_v1(struct gpio_chardev_data *cdev, void __user *ip,
return -EFAULT; return -EFAULT;
/* this doubles as a range check on line_offset */ /* this doubles as a range check on line_offset */
desc = gpiochip_get_desc(cdev->gdev->chip, lineinfo.line_offset); desc = gpio_device_get_desc(cdev->gdev, lineinfo.line_offset);
if (IS_ERR(desc)) if (IS_ERR(desc))
return PTR_ERR(desc); return PTR_ERR(desc);
...@@ -2456,7 +2456,7 @@ static int lineinfo_get(struct gpio_chardev_data *cdev, void __user *ip, ...@@ -2456,7 +2456,7 @@ static int lineinfo_get(struct gpio_chardev_data *cdev, void __user *ip,
if (memchr_inv(lineinfo.padding, 0, sizeof(lineinfo.padding))) if (memchr_inv(lineinfo.padding, 0, sizeof(lineinfo.padding)))
return -EINVAL; return -EINVAL;
desc = gpiochip_get_desc(cdev->gdev->chip, lineinfo.offset); desc = gpio_device_get_desc(cdev->gdev, lineinfo.offset);
if (IS_ERR(desc)) if (IS_ERR(desc))
return PTR_ERR(desc); return PTR_ERR(desc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment