From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "Uwe Kleine-König"
<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: "Sean Nyekjær"
<sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>,
linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] sc16is7xx: null ptr check
Date: Mon, 5 Oct 2015 09:10:04 +0100 [thread overview]
Message-ID: <20151005081004.GG12635@sirena.org.uk> (raw)
In-Reply-To: <20151005063127.GX3982-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]
On Mon, Oct 05, 2015 at 08:31:28AM +0200, Uwe Kleine-König wrote:
> So in the broken case the device in question was bound to the
> sc16is7xx driver because the compatible name was matched by the
> id_table and not the of_match_table. My first thought was that in this
> case the spi_device's dev->of_node should not be set, but after having
> thought a bit more I think this is right.
Yes, it's intended behaviour - the DT is buggy here.
> But the .probe routine could be a tad more clever here:
> devtype = of_device_get_match_data(&spi->dev);
> if (!devtype) {
> const struct spi_device_id *id_entry = spi_get_device_id(spi);
>
> /* Do I need to check id_entry being != NULL here? */
> devtype = (struct sc16is7xx_devtype *)id_entry->driver_data;
> flags = IRQF_TRIGGER_FALLING;
> }
That's pretty much a requirement - the driver should work no matter
which binding method gets used, OF only drivers aren't great practice at
the best of times and for off-SoC devices like this one it's definitely
not appropriate.
> Apart from that using "flags = IRQF_TRIGGER_FALLING" iff the device was
> probed via spi_id_table is strange.
That seems like an obvious bug.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2015-10-05 8:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1441015287-14240-1-git-send-email-sean.nyekjaer@prevas.dk>
[not found] ` <20151004202316.GV3982@pengutronix.de>
[not found] ` <56120E09.7060702@prevas.dk>
[not found] ` <56120E09.7060702-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
2015-10-05 6:31 ` [PATCH] sc16is7xx: null ptr check Uwe Kleine-König
[not found] ` <20151005063127.GX3982-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-10-05 8:10 ` Mark Brown [this message]
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=20151005081004.GG12635@sirena.org.uk \
--to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org \
--cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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