platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Chris <chrisrblake93@gmail.com>
Cc: Platform Driver <platform-driver-x86@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Christian Lamparter <chunkeey@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH v3] platform/x86: add meraki-mx100 platform driver
Date: Mon, 9 Aug 2021 15:32:11 +0300	[thread overview]
Message-ID: <CAHp75Ve2i-5x-Xuoo3Z=JATFXqjV76aGyrnmEz+4d5qR7tLPJw@mail.gmail.com> (raw)
In-Reply-To: <CALpBJjpSJQquzaT14TkoEbTHrvtN8kiQWKLs3n0ZNiziB=iwCA@mail.gmail.com>

On Mon, Aug 9, 2021 at 3:29 PM Chris <chrisrblake93@gmail.com> wrote:
> On Mon, Aug 9, 2021 at 7:22 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Mon, Aug 9, 2021 at 3:13 PM Chris Blake <chrisrblake93@gmail.com> wrote:

(I left below context on purpose)

> > > +static struct platform_device * __init tink_create_dev(
> > > +       const char *name, const void *pdata, size_t sz)
> > > +{
> > > +       struct platform_device *pdev;
> > > +
> > > +       pdev = platform_device_register_data(NULL,
> > > +               name, PLATFORM_DEVID_NONE, pdata, sz);
> > > +       if (IS_ERR(pdev))
> > > +               pr_err("failed registering %s: %ld\n", name, PTR_ERR(pdev));
> > > +
> > > +       return pdev;
> > > +}
> > > +
> > > +static int __init tink_board_init(void)
> > > +{
> > > +       if (!dmi_first_match(tink_systems))
> > > +               return -ENODEV;
> > > +
> > > +       /*
> > > +        * We need to make sure that GPIO60 isn't set to native mode as is default since it's our
> > > +        * Reset Button. To do this, write to GPIO_USE_SEL2 to have GPIO60 set to GPIO mode.
> > > +        * This is documented on page 1609 of the PCH datasheet, order number 327879-005US
> > > +        */
> > > +       outl(inl(0x530) | BIT(28), 0x530);
> > > +
> > > +       gpiod_add_lookup_table(&tink_leds_table);
> > > +       gpiod_add_lookup_table(&tink_keys_table);
> > > +
> > > +       tink_leds_pdev = tink_create_dev("leds-gpio",
> > > +               &tink_leds_pdata, sizeof(tink_leds_pdata));
> >
> > Seems you forgot to add
> > if (IS_ERR())
> >   return PTR_ERR();
> >
> > here...
> >
> > > +       tink_keys_pdev = tink_create_dev("gpio-keys-polled",
> > > +               &tink_buttons_pdata, sizeof(tink_buttons_pdata));
> >
> > and
> >
> > if (IS_ERR()) {
> >  pdev_unreg();
> >  return PTR_ERR();
> > }
> >
> > here.
>
> Are these IS_ERR catches needed since they are done in the
> tink_create_dev struct? This is the same structure as currently done
> in drivers/platform/x86/pcengines-apuv2.c. Adding these 2x additions
> feels a bit redundant, but if I am wrong please correct me.

Care to describe how it's supposed to be taken into account in your opinion?

> > > +       return 0;
> > > +}


-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-08-09 12:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09 12:13 [PATCH v3] platform/x86: add meraki-mx100 platform driver Chris Blake
2021-08-09 12:20 ` Chris
2021-08-09 12:23   ` Andy Shevchenko
2021-08-09 12:22 ` Andy Shevchenko
2021-08-09 12:29   ` Chris
2021-08-09 12:32     ` Andy Shevchenko [this message]
2021-08-09 12:46       ` Chris
2021-08-09 23:51         ` Chris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75Ve2i-5x-Xuoo3Z=JATFXqjV76aGyrnmEz+4d5qR7tLPJw@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=chrisrblake93@gmail.com \
    --cc=chunkeey@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).