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]
Date:   Thu, 14 May 2020 13:59:35 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
Cc:     Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Linux Media Mailing List <linux-media@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Kieran Bingham <kieran.bingham@...asonboard.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Jacopo Mondi <jacopo@...ndi.org>,
        Niklas Söderlund <niklas.soderlund@...natech.se>,
        Sakari Ailus <sakari.ailus@....fi>,
        Hans Verkuil <hverkuil@...all.nl>,
        Hyun Kwon <hyunk@...inx.com>, Rob Herring <robh+dt@...nel.org>,
        Jacopo Mondi <jacopo+renesas@...ndi.org>,
        Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
        Niklas Söderlund 
        <niklas.soderlund+renesas@...natech.se>
Subject: Re: [PATCH v9 2/4] media: i2c: Add MAX9286 driver

Hi Kieran,

On Thu, May 14, 2020 at 1:47 PM Kieran Bingham
<kieran.bingham+renesas@...asonboard.com> wrote:
> On 14/05/2020 11:13, Manivannan Sadhasivam wrote:
> > On Thu, May 14, 2020 at 11:02:53AM +0100, Kieran Bingham wrote:
> >> On 12/05/2020 19:17, Manivannan Sadhasivam wrote:
> >>> On Tue, May 12, 2020 at 04:51:03PM +0100, Kieran Bingham wrote:
> >>>> The MAX9286 is a 4-channel GMSL deserializer with coax or STP input and
> >>>> CSI-2 output. The device supports multicamera streaming applications,
> >>>> and features the ability to synchronise the attached cameras.
> >>>>
> >>>> CSI-2 output can be configured with 1 to 4 lanes, and a control channel
> >>>> is supported over I2C, which implements an I2C mux to facilitate
> >>>> communications with connected cameras across the reverse control
> >>>> channel.
> >>>>
> >>>> Signed-off-by: Jacopo Mondi <jacopo+renesas@...ndi.org>
> >>>> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
> >>>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
> >>>> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>

> >>>> --- /dev/null
> >>>> +++ b/drivers/media/i2c/max9286.c

> >>>> +static int max9286_register_gpio(struct max9286_priv *priv)
> >>>> +{
> >>>> +  struct device *dev = &priv->client->dev;
> >>>> +  struct gpio_chip *gpio = &priv->gpio;
> >>>> +  int ret;
> >>>> +
> >>>> +  static const char * const names[] = {
> >>>> +          "GPIO0OUT",
> >>>> +          "GPIO1OUT",
> >>>> +  };
> >>>> +
> >>>> +  /* Configure the GPIO */
> >>>> +  gpio->label = dev_name(dev);
> >>>
> >>> So if you have more than one MAX9286 in a system, all gpiochips will appear
> >>> with the same name. I'd recommend to append the index to distinguish properly.
> >>
> >> Ah yes, that's a good point, and I think I've even seen that.
> >>
> >> I'll fix it now.
>
> Oh, in fact actually this doesn't.
>
> gpiodetect prints:
>
> gpiochip10 [4-004c] (2 lines)
> gpiochip11 [4-006c] (2 lines)
>
> and mostly references them as gpiochip10 and gpiochip11.

Indeed, dev_name() should be different for each instance.

> However,
>
> > [    2.318533] gpio gpiochip11: Detected name collision for GPIO name 'GPIO0OUT'
> > [    2.325739] gpio gpiochip11: Detected name collision for GPIO name 'GPIO1OUT'
>
> That seems to be more of a problem for the gpio library, so I think I'll
> just drop the const names. I don't think they add much value.

These are the line names.  If they're not unique, a warning is printed,
but they are still registered.
So probably you want to use kasprintf("%s.%s", dev_name(dev), names[i]) to
generate names.

See "[PATCH] gpiolib: Document that GPIO line names are not globally unique"
(https://lore.kernel.org/linux-gpio/20200511101828.30046-1-geert+renesas@glider.be/)
to clear up the details.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists