30 Sep, 2020
9 commits
-
Let's move the code preparing the device properties into a separate
routine. This has the advantage of simplifying the error handling and
makes the indentation less deep.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
GPIO line names are currently created by the driver from the chip label.
We'll want to support custom formats for line names (for instance: to
name all lines the same) for user-space tests so create them in the
module init function and pass them to the driver using the standard
'gpio-line-names' property.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
While we do check the "chip-name" property in probe(), we never actually
use it. Let's pass the chip label to the driver using device properties
as we'll want to allow users to define their own once dynamically
created chips are supported.The property is renamed to "chip-label" to not cause any confusion with
the actual chip name which is of the form: "gpiochipX".If the "chip-label" property is missing, let's do what most devices in
drivers/gpio/ do and use dev_name().Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
The driver actually supports 4 properties but we only ever set up up to
three. This will change however in upcoming patches so increase the
number of really (as in: the number the property array can hold)
supported properties to 4.Reported-by: Andy Shevchenko
Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
There's a return; at the end of a void function. This is not needed so
remove it.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
We don't need a custom logging helper. Let's use the standard pr_fmt()
macro which allows us to use all pr_*() routines with custom format.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
Drop the definition for the driver name. Let's use KBUILD_MODNAME for
the log format and use the "gpio-mockup" value directly in the only
place where it's relevant: in the name of the device.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
This module doesn't need gpio/consumer.h - it's a provider. It also
doesn't use any symbols from init.h so let's remove both includes.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko -
If the module init function fails after creating the debugs directory,
it's never removed. Add proper cleanup calls to avoid this resource
leak.Fixes: 9202ba2397d1 ("gpio: mockup: implement event injecting over debugfs")
Cc:
Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko
18 May, 2020
1 commit
-
The interrupt simulator API exposes a lot of custom data structures and
functions and doesn't reuse the interfaces already exposed by the irq
subsystem. This patch tries to address it.We hide all the simulator-related data structures from users and instead
rely on the well-known irq domain. When creating the interrupt simulator
the user receives a pointer to a newly created irq_domain and can use it
to create mappings for simulated interrupts.It is also possible to pass a handle to fwnode when creating the simulator
domain and retrieve it using irq_find_matching_fwnode().The irq_sim_fire() function is dropped as well. Instead we implement the
irq_get/set_irqchip_state interface.We modify the two modules that use the simulator at the same time as
adding these changes in order to reduce the intermediate bloat that would
result when trying to migrate the drivers in separate patches.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Marc Zyngier
Reviewed-by: Linus Walleij
Acked-by: Jonathan Cameron #for IIO
Link: https://lore.kernel.org/r/20200514083901.23445-3-brgl@bgdev.pl
20 Feb, 2020
1 commit
-
The indentation is wrong in gpio_mockup_apply_pull(). This patch makes
the code more readable.Signed-off-by: Bartosz Golaszewski
Link: https://lore.kernel.org/r/20200210155059.29609-1-brgl@bgdev.pl
Signed-off-by: Linus Walleij
17 Jan, 2020
1 commit
-
Linux 5.5-rc6
15 Jan, 2020
2 commits
-
For consistency and easier maintenance: sort the headers alphabetically.
Signed-off-by: Bartosz Golaszewski
Link: https://lore.kernel.org/r/20200114150253.28716-3-brgl@bgdev.pl
Signed-off-by: Linus Walleij -
The current GPL v2.0 or later SPDX tag is 'GPL-2.0-or-later' as defined
at https://spdx.org/licenses/.Signed-off-by: Bartosz Golaszewski
Link: https://lore.kernel.org/r/20200114150253.28716-2-brgl@bgdev.pl
Signed-off-by: Linus Walleij
04 Jan, 2020
1 commit
-
I have missed two indentation issues in commit 64e7112ee307 ("gpio:
mockup: add set_config to support pull up/down"). This commit fixes them.Fixes: 64e7112ee307 ("gpio: mockup: add set_config to support pull up/down")
Signed-off-by: Bartosz Golaszewski
11 Dec, 2019
1 commit
-
Restore the external behavior of gpio-mockup to what it was prior to the
change to using GPIO_LINE_DIRECTION.Fixes: e42615ec233b ("gpio: Use new GPIO_LINE_DIRECTION")
Signed-off-by: Kent Gibson
Signed-off-by: Bartosz Golaszewski
12 Nov, 2019
1 commit
-
Add support for the pull up/down state set via gpiolib line requests to
be reflected in the state of the mockup.
Use case is for testing of the GPIO uAPI, specifically the pull up/down
flags.Signed-off-by: Kent Gibson
Signed-off-by: Bartosz Golaszewski
07 Nov, 2019
1 commit
-
It's hard for occasional GPIO code reader/writer to know if values 0/1
equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and
GPIO_LINE_DIRECTION_OUT to help them out.NOTE - for gpio-amd-fch and gpio-bd9571mwv:
This commit also changes the return value for direction get to equal 1
for direction INPUT. Prior this commit these drivers might have
returned some other positive value but 1 for INPUT.Signed-off-by: Matti Vaittinen
Acked-by: Scott Branden
Reviewed-by: Grygorii Strashko
Reviewed-by: Michal Simek
Reviewed-by: Geert Uytterhoeven
Acked-by: Andy Shevchenko
Acked-by: William Breathitt Gray
Acked-by: Kuppuswamy Sathyanarayanan
Signed-off-by: Linus Walleij
09 Sep, 2019
1 commit
-
When using single_open() for opening, single_release() should be
used instead of seq_release(), otherwise there is a memory leak.Fixes: 2a9e27408e12 ("gpio: mockup: rework debugfs interface")
Cc: stable
Signed-off-by: Wei Yongjun
Signed-off-by: Bartosz Golaszewski
27 Jun, 2019
1 commit
-
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.Cc: Bamvor Jian Zhang
Cc: Linus Walleij
Cc: Bartosz Golaszewski
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman
[Bartosz: removed one more check for debugfs return value]
Signed-off-by: Bartosz Golaszewski
Reviewed-by: Linus Walleij
29 Mar, 2019
1 commit
-
Calling read() for a single byte read will return 2 currently. Use
simple_read_from_buffer() which correctly handles all sizes.Fixes: 2a9e27408e12 ("gpio: mockup: rework debugfs interface")
Reviewed-by: Mukesh Ojha
Signed-off-by: Bartosz Golaszewski
27 Mar, 2019
1 commit
-
The debugfs read callback must advance ppos or users using read() on
the file descriptor will never get the EOL. This wasn't spotted before
as I was using busybox cat for testing which uses sendfile() internally
and only noticed it now when switched to cat from coreutils.Fixes: 2a9e27408e12 ("gpio: mockup: rework debugfs interface")
Signed-off-by: Bartosz Golaszewski
20 Feb, 2019
6 commits
-
Modify the way the debugfs interface works in gpio-mockup. Introduce
the concept of dummy pull config which will keep the mockup lines in
known state. The pull values can be modified by writing to the debugfs
files corresponding to lines. Lines in input mode always report the
current pull value, lines in output mode change the line value but
it will revert back to the one specified by current pull when released.Signed-off-by: Bartosz Golaszewski
-
The unlocked variants only get called from places where we already have
the pointer to the underlying gpio_mockup_chip structure, so take it
as parameter instead of struct gpio_chip.Signed-off-by: Bartosz Golaszewski
-
This field can never be negative.
Signed-off-by: Bartosz Golaszewski
-
User-space tests no longer use it and we're breaking the interface
anyway.Signed-off-by: Bartosz Golaszewski
-
We already support set_multiple(). Implement get_multiple() as well.
Signed-off-by: Bartosz Golaszewski
-
While no user reported any race condition problems with gpio-mockup,
let's be on the safe side and use a mutex when performing any changes
on the dummy chip structures.Suggested-by: Uwe Kleine-König
Signed-off-by: Bartosz Golaszewski
17 Nov, 2018
1 commit
-
Commit 3edfb7bd76bd ("gpiolib: Show correct direction from the
beginning") fixed an existing issue but broke libgpiod tests by
changing the default direction of dummy lines to output.We don't break user-space so make gpio-mockup behave as before.
Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij
03 Oct, 2018
1 commit
-
Some users want to introduce device tree support to the mockup driver.
Let's make it easier by switching to using generic device properties.
The driver stays compatible with previous use cases and after this
conversion there'll be no need to change the way probing of mockup
GPIO chips works.Tested with libgpiod test suite.
Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij
16 May, 2018
1 commit
-
Use the SPDX license identifier for GPLv2.0 or later and remove the
license boilerplate.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij
27 Mar, 2018
1 commit
-
If we failed to create the top debugfs directory, we must not try to
create the child nodes. We currently only check if gpio_mockup_dbg_dir
is not NULL, but it can also contain an errno if debugfs is disabled
in build options. Use IS_ERR_OR_NULL() instead.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij
06 Mar, 2018
1 commit
-
Bamvor changed his mail so let's updat his mail address
everywhere.Cc: Bamvor Jian Zhang
Signed-off-by: Linus Walleij
08 Dec, 2017
1 commit
-
The return value of platform_device_register_resndata() on error is
an error code converted to pointer with ERR_PTR(), not NULL.Check the return value correctly.
Fixes: 8a39f597bcfd ("gpio: mockup: rework device probing")
Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij
03 Dec, 2017
6 commits
-
In order to avoid repeating the calculations on every access - add
helpers for gpio base and ngpio components of the ranges array.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij -
This variable holds the number of mockup GPIO ranges so rename it
accordingly.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij -
As discussed with Marc Zyngier: irq_sim_init() and its devres variant
should return the base of the allocated interrupt range on success
rather than 0. This will be modified later - first, change the way
users handle the return value of these routines.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij -
Implement the set_multiple() callback and register it with the gpiolib
framework. This is only meant to also test the internal kernel API.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij -
Minor readability tweak: prefer breaking the lines in a way where the
second part is longer than the first.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij -
Improve the module params sanitization: bail out from init if the user
tries to pass a non-positive number of GPIO lines for any mockup chip.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Linus Walleij