lkml.org 
[lkml]   [2013]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] gpio: add GPIO support for F71882FG and F71889F
From
On Wed, Jun 26, 2013 at 1:56 PM, Simon Guinot <simon.guinot@sequanux.org> wrote:

> This patch adds support for the GPIOs found on the Fintek Super-I/O
> chips F71882FG and F71889F.
>
> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>

Please be more elaborate in the commit message. What kind of beast
is a Super-I/O chip? Which architecture is this? Some SoC?
ISA card? etc. References are made to ACPI so I'm just half-guessing...

> +++ b/drivers/gpio/gpio-f7188x.c

> +#define gpio_oe_reg(base) (base + 0)
> +#define gpio_od_reg(base) (base + 1)
> +#define gpio_st_reg(base) (base + 2)
> +#define gpio_de_reg(base) (base + 3)

What are these four things?

Output enable, open drain, ...?

> +static int __init
> +f7188x_gpio_device_add(const struct f7188x_sio *sio)
> +{
> + int err;
> +
> + f7188x_gpio_pdev = platform_device_alloc(DRVNAME, -1);
> + if (!f7188x_gpio_pdev)
> + return -ENOMEM;
> +
> + err = platform_device_add_data(f7188x_gpio_pdev,
> + sio, sizeof(*sio));
> + if (err) {
> + pr_err(DRVNAME "Platform data allocation failed\n");
> + goto err;
> + }
> +
> + err = platform_device_add(f7188x_gpio_pdev);
> + if (err) {
> + pr_err(DRVNAME "Device addition failed\n");
> + goto err;
> + }
> +
> + return 0;
> +
> +err:
> + platform_device_put(f7188x_gpio_pdev);
> +
> + return err;
> +}

You need to explain with some comment here what is happening
here. You auto-probe then spawn some devices?

> +static struct platform_driver f7188x_gpio_driver = {
> + .driver = {
> + .owner = THIS_MODULE,
> + .name = DRVNAME,
> + },
> + .probe = f7188x_gpio_probe,
> + .remove = f7188x_gpio_remove,
> +};
> +
> +static int __init f7188x_gpio_init(void)
> +{
> + int err;
> + struct f7188x_sio sio;
> +
> + if (f7188x_find(0x2e, &sio) &&
> + f7188x_find(0x4e, &sio))
> + return -ENODEV;

This looks like the life on the ISA-bus. Is that not dangerous?

> +
> + err = platform_driver_register(&f7188x_gpio_driver);
> + if (!err) {
> + err = f7188x_gpio_device_add(&sio);
> + if (err)
> + platform_driver_unregister(&f7188x_gpio_driver);
> + }
> +
> + return err;
> +}
> +subsys_initcall(f7188x_gpio_init);

And this is called unconditionally. Don't you get hints from
ACPI (given you include that header) as to whether this needs
to be registered or not?

It looks quite backwards. Isn't there *any* way to tell if the
system actually has this thing?

Yours,
Linus Walleij


\
 
 \ /
  Last update: 2013-06-30 01:41    [W:0.200 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site