summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mockup.c
Commit message (Collapse)AuthorAgeFilesLines
* gpio: mockup: return -EFAULT if copy_from_user() failsDan Carpenter2017-03-061-4/+3
| | | | | | | | | | copy_from_user() returns the number of bytes remaining to be copied but we want to return negative error codes on failue. Fixes: 9202ba2397d1 ("gpio: mockup: implement event injecting over debugfs") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: implement event injecting over debugfsBartosz Golaszewski2017-02-131-1/+115
| | | | | | | | | Create a debugfs directory for every mockup chip and a single file for every line. Writing (0 or 1) to these files allows the user to inject line events (falling or rising edge respectively). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: add a dummy irqchipBartosz Golaszewski2017-02-131-0/+79
| | | | | | | | Setup a dummy irqchip that will allow us to inject line events for testing purposes. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: implement naming the linesBartosz Golaszewski2017-02-061-0/+35
| | | | | | | | | | In order to allow testing line lookup by name from user space, add a new boolean parameter that indicates whether we want the lines to be named. The name is created by concatenating the chip name and the line offset value. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: code shrinkBartosz Golaszewski2017-02-061-21/+8
| | | | | | | | Moving a couple of lines around allows us to shrink the code a bit while keeping the same functionality. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: readability tweaksBartosz Golaszewski2017-02-061-57/+66
| | | | | | | | | | | | | | | | The following patch tries to improve the readability of the mockup driver. The driver is called gpio-mockup, so add the same prefix to all functions and structures. Add some newlines and use a temporary pointer in gpio_mockup_add(). Drop the name of the direction enum and rename the enum values to better reflect their purpose. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: coding style fixesBartosz Golaszewski2016-12-281-7/+4
| | | | | | | | Fix whitespace errors and arrange local variables for better readability. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: dynamically allocate memory for chip nameBartosz Golaszewski2016-12-281-3/+7
| | | | | | | | | | | Currently the chip name buffer is allocated on the stack and the address of the buffer is passed to the gpio framework. It's invalid after probe() returns, so the sysfs label attribute displays garbage. Use devm_kasprintf() for each string instead. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: make pins_name_start staticBartosz Golaszewski2016-12-281-1/+1
| | | | | | | This variable is not used outside this module. Make it static. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio/mockup: add virtual gpio deviceBamvor Jian Zhang2016-09-261-0/+214
This patch add basic structure of a virtual gpio device(gpio-mockup) for testing gpio subsystem. The tester could manipulate such device through userspace(sysfs or char device) and check the result from debugfs. Currently, it support one or more gpiochip(determined by module parameters with base,ngpio pair). One could test the overlap of different gpiochip and test the direction and/or output values of these chips. Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
OpenPOWER on IntegriCloud