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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANLsYkxfnF9-H9mawt3BWTgy5gjf8Qs3O6iSRGiLQ=8vfYACTQ@mail.gmail.com>
Date:   Wed, 26 Oct 2016 10:42:28 -0600
From:   Mathieu Poirier <mathieu.poirier@...aro.org>
To:     Antoine Tenart <antoine.tenart@...e-electrons.com>
Cc:     Maxime Ripard <maxime.ripard@...e-electrons.com>,
        pantelis.antoniou@...sulko.com,
        Mark Rutland <mark.rutland@....com>, sboyd@...eaurora.org,
        Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [RFC PATCH 4/5] w1: add a callback to call slave when a new
 device is connected

On 26 October 2016 at 08:57, Antoine Tenart
<antoine.tenart@...e-electrons.com> wrote:
> This patch adds the possibility for slave drivers to register a
> callback, to be called whenever a new device matching the slave ID
> is connected.
>
> Signed-off-by: Antoine Tenart <antoine.tenart@...e-electrons.com>
> ---
>  drivers/w1/w1.c        | 10 ++++++++++
>  drivers/w1/w1_family.h |  2 ++
>  2 files changed, 12 insertions(+)
>
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index 80d0cc4e6e7f..7010ffd1ea93 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -659,6 +659,16 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl)
>                                 return err;
>                         }
>                 }
> +               if (fops->callback) {
> +                       err = fops->callback(sl);
> +                       /*
> +                        * Do not return an error as the slave driver correctly
> +                        * probed.
> +                        */

I don't get this part.  What's the point of calling a callback if a
failure is not important - maybe I'm just missing something.

> +                       if (err)
> +                               dev_err(&sl->dev,
> +                                       "callback call failed. err=%d\n", err);
> +               }
>
>                 break;
>         case BUS_NOTIFY_DEL_DEVICE:
> diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
> index 10a7a0767187..5e165babc6f3 100644
> --- a/drivers/w1/w1_family.h
> +++ b/drivers/w1/w1_family.h
> @@ -55,11 +55,13 @@ struct w1_slave;
>   * @add_slave: add_slave
>   * @remove_slave: remove_slave
>   * @groups: sysfs group
> + * @callback: called when a new device is discovered
>   */
>  struct w1_family_ops
>  {
>         int  (* add_slave)(struct w1_slave *);
>         void (* remove_slave)(struct w1_slave *);
> +       int  (* callback)(struct w1_slave *);
>         const struct attribute_group **groups;
>  };
>
> --
> 2.10.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ