aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mockup.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-30 14:33:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-30 14:33:34 -0400
commit3af9a5256f448e3d0405f7905c430ef2f9f32b9c (patch)
tree947da1e128e28c3b0b7134a8d08f3a6bb8534fc0 /drivers/gpio/gpio-mockup.c
parent32faca66bd3f6aa7ec4212d20c7b2d45657fab10 (diff)
parent86d0756558b701b2c5502d90f705c2936008922d (diff)
Merge tag 'gpio-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: "As you can see [in the git history] I was away on leave and Bartosz kindly stepped in and collected a slew of fixes, I pulled them into my tree in two sets and merged some two more fixes (fixing my own caused bugs) on top. Summary: - Revert the extended use of gpio_set_config() and think about how we can do this properly. - Fix up the SPI CS GPIO handling so it now works properly on the SPI bus children, as intended. - Error paths and driver fixes" * tag 'gpio-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: mockup: use simple_read_from_buffer() in debugfs read callback gpio: of: Fix of_gpiochip_add() error path gpio: of: Check for "spi-cs-high" in child instead of parent node gpio: of: Check propname before applying "cs-gpios" quirks gpio: mockup: fix debugfs read Revert "gpio: use new gpio_set_config() helper in more places" gpio: aspeed: fix a potential NULL pointer dereference gpio: amd-fch: Fix bogus SPDX identifier gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input gpio: exar: add a check for the return value of ida_simple_get fails
Diffstat (limited to 'drivers/gpio/gpio-mockup.c')
-rw-r--r--drivers/gpio/gpio-mockup.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index 154d959e8993..b6a4efce7c92 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
204 struct gpio_mockup_chip *chip; 204 struct gpio_mockup_chip *chip;
205 struct seq_file *sfile; 205 struct seq_file *sfile;
206 struct gpio_chip *gc; 206 struct gpio_chip *gc;
207 int val, cnt;
207 char buf[3]; 208 char buf[3];
208 int val, rv;
209 209
210 if (*ppos != 0) 210 if (*ppos != 0)
211 return 0; 211 return 0;
@@ -216,13 +216,9 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
216 gc = &chip->gc; 216 gc = &chip->gc;
217 217
218 val = gpio_mockup_get(gc, priv->offset); 218 val = gpio_mockup_get(gc, priv->offset);
219 snprintf(buf, sizeof(buf), "%d\n", val); 219 cnt = snprintf(buf, sizeof(buf), "%d\n", val);
220 220
221 rv = copy_to_user(usr_buf, buf, sizeof(buf)); 221 return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt);
222 if (rv)
223 return rv;
224
225 return sizeof(buf) - 1;
226} 222}
227 223
228static ssize_t gpio_mockup_debugfs_write(struct file *file, 224static ssize_t gpio_mockup_debugfs_write(struct file *file,