lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkda=BBo+yUcUorYQQasKaF68neSz8cVmq3PcwLGPY_FjtA@mail.gmail.com>
Date:	Sun, 30 Jun 2013 01:35:00 +0200
From:	Linus Walleij <linus.walleij@...aro.org>
To:	Simon Guinot <simon.guinot@...uanux.org>
Cc:	Grant Likely <grant.likely@...retlab.ca>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Vincent Donnefort <vdonnefort@...il.com>
Subject: Re: [PATCH] gpio: add GPIO support for F71882FG and F71889F

On Wed, Jun 26, 2013 at 1:56 PM, Simon Guinot <simon.guinot@...uanux.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@...uanux.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ