Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1472180

Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states

From Tony Lindgren <tony@atomide.com>
Newsgroups linux.kernel
Subject Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states
Date 2016-08-30 02:40 +0200
Message-ID <sbFfP-5Zk-3@gated-at.bofh.it> (permalink)
References <sbDnJ-4Pc-59@gated-at.bofh.it> <sbF69-5VZ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Rob Herring <robh+dt@kernel.org> [160829 17:24]:
> On Mon, Aug 29, 2016 at 5:35 PM, Tony Lindgren <tony@atomide.com> wrote:
> > It seems we can use the ePAPR 1.1 status fail-sss to do this.
> > Quoting "Table 2-4 Values for status property" we have "fail-sss":
> >
> > "Indicates that the device is not operational. A serious error was
> >  detected in the device and it is unlikely to become operational
> >  without repair. The sss portion of the value is specific to the
> >  device and indicates the error condition detected."
> 
> I had read this as 'sss' is just 3 characters, but I guess that doesn't matter.

Yeah I'd assume it does not matter for the length.

> > We can handle these fail states can be handled in a generic
> > way. So let's introduce a generic status = "fail-" that
> > describes a situation where a device driver probe should just
> > shut down or idle the device if possible and then bail out.
> > This allows the SoC variant and board specific dts files to set
> > the status as needed.
> >
> > The suggested usage in a device driver probe is:
> >
> > static int foo_probe(struct platform_device *pdev)
> > {
> >         int err;
> >         const char *status;
> >         ...
> >
> >         pm_runtime_enable(&pdev->dev);
> >         pm_runtime_get_sync(&pdev->dev);
> >         pm_runtime_use_autosuspend(&pdev->dev);
> >         ...
> >
> >         /* Configure device, load firmware, idle device */
> >         ...
> >
> >         if (of_device_is_incomplete(pdev->dev.of_node, status)) {
> 
> &status

Oops, I guess I should compile test the example.

> >                 if (!strcmp("hw-incomplete-pins", status)) {
> >                         dev_info(&pdev->dev,
> >                                  "Unusable hardware: Not pinned out\n");
> >                         err = -ENODEV;
> >                         goto out;
> >                 }
> >                 if (!strcmp("hw-missing-daughter-card")) {
> >                         err = -EPROBE_DEFER;
> 
> This implies we're going to change this on the fly? I guess
> disabled->okay can already happen.

Well let's assume the bootloader sets some i2c controlled daughter
board with "fail-hw-missing-daughter-card", then in theory kernel
could probe it if it pops up on the i2c bus later on. Not sure if
we want to do this, but it seems we could..

> > +static bool __of_device_is_incomplete(const struct device_node *device,
> > +                                     const char **status)
> > +{
> > +       const char *s, *m = "fail-";
> > +       int slen, mlen;
> > +
> > +       if (!device)
> > +               return false;
> > +
> > +       s = __of_get_property(device, "status", &slen);
> 
> You can use the string helper function here (or is the lock a problem?).

I'll check.

> Overall, seems okay to me.

OK thanks for looking.

Regards,

Tony

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Tony Lindgren <tony@atomide.com> - 2016-08-30 00:40 +0200
  Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Rob Herring <robh+dt@kernel.org> - 2016-08-30 02:30 +0200
    Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Tony Lindgren <tony@atomide.com> - 2016-08-30 02:40 +0200
      Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Tony Lindgren <tony@atomide.com> - 2016-08-31 19:50 +0200
  Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Frank Rowand <frowand.list@gmail.com> - 2016-08-31 23:00 +0200
    Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Tony Lindgren <tony@atomide.com> - 2016-08-31 23:50 +0200
      Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Rob Herring <robh+dt@kernel.org> - 2016-09-08 15:40 +0200
        Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Nishanth Menon <nm@ti.com> - 2016-09-08 16:30 +0200
        Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Tony Lindgren <tony@atomide.com> - 2016-09-08 18:00 +0200
          Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Frank Rowand <frowand.list@gmail.com> - 2016-09-08 21:10 +0200
            Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Frank Rowand <frowand.list@gmail.com> - 2016-09-08 21:20 +0200
              Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Tony Lindgren <tony@atomide.com> - 2016-09-08 22:20 +0200
        Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Frank Rowand <frowand.list@gmail.com> - 2016-09-08 21:10 +0200
          Re: [PATCHv2] of: Add generic handling for ePAPR 1.1 fail-sss states Rob Herring <robh+dt@kernel.org> - 2016-09-09 04:50 +0200

csiph-web