From: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
gregkh-l3A5Bk7waGM@public.gmane.org,
linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Alan Cox <alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC PATCH 1/2] serial: 8250: Add a notifier chain for driver registration.
Date: Thu, 17 Mar 2011 11:42:19 -0700 [thread overview]
Message-ID: <4D82560B.4090800@caviumnetworks.com> (raw)
In-Reply-To: <20110317182510.GN9597-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
On 03/17/2011 11:25 AM, Grant Likely wrote:
> On Thu, Mar 17, 2011 at 12:18:49PM +0000, Alan Cox wrote:
>> On Wed, 16 Mar 2011 18:26:06 -0700
>> David Daney<ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org> wrote:
>>
>>> The 8250 driver is a bit weird in that in addition to supporting
>>> platform devices, extra devices can be added by calling
>>> serial8250_register_port().
>>>
>>> The problem is that if we call serial8250_register_port() before the
>>> driver is initialized Bad Things happen (we dereference NULL
>>> pointers).
>>>
>>> There doesn't seem to be a general way to know if a driver has been
>>> initialized
>>
>> I've had a bigger dig into this. I think the correct answer is probably
>> "always go via platform devices or similar". That *is* the notifier in
>> the kernel of today. serial8250_register_port ultimately should I think
>> ultimatly become an internal helper.
>
> +1
>
> Depending on serial8250_register_port() definitely the wrong thing to
> do for platform support code. It would be better to figure out how to
> get the dt bits you need into 8250.c or of_serial.c.
>
IMHO, of_serial.c is no better than my board/chip specific code that
calls serial8250_register_port().
Really what would be ideal would be a hook to add a dev.platform_data
pointer to the appropriate struct plat_serial8250_port when the platform
device is created. It is possible that the platform bus notifiers could
be used for this. We would also want to have a way to add an
of_device_id to those recognized by 8250.c
If we did that, serial8250_probe() would automatically do the right thing.
David Daney
WARNING: multiple messages have this Message-ID (diff)
From: David Daney <ddaney@caviumnetworks.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-serial@vger.kernel.org, gregkh@suse.de,
linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org
Subject: Re: [RFC PATCH 1/2] serial: 8250: Add a notifier chain for driver registration.
Date: Thu, 17 Mar 2011 11:42:19 -0700 [thread overview]
Message-ID: <4D82560B.4090800@caviumnetworks.com> (raw)
In-Reply-To: <20110317182510.GN9597@angua.secretlab.ca>
On 03/17/2011 11:25 AM, Grant Likely wrote:
> On Thu, Mar 17, 2011 at 12:18:49PM +0000, Alan Cox wrote:
>> On Wed, 16 Mar 2011 18:26:06 -0700
>> David Daney<ddaney@caviumnetworks.com> wrote:
>>
>>> The 8250 driver is a bit weird in that in addition to supporting
>>> platform devices, extra devices can be added by calling
>>> serial8250_register_port().
>>>
>>> The problem is that if we call serial8250_register_port() before the
>>> driver is initialized Bad Things happen (we dereference NULL
>>> pointers).
>>>
>>> There doesn't seem to be a general way to know if a driver has been
>>> initialized
>>
>> I've had a bigger dig into this. I think the correct answer is probably
>> "always go via platform devices or similar". That *is* the notifier in
>> the kernel of today. serial8250_register_port ultimately should I think
>> ultimatly become an internal helper.
>
> +1
>
> Depending on serial8250_register_port() definitely the wrong thing to
> do for platform support code. It would be better to figure out how to
> get the dt bits you need into 8250.c or of_serial.c.
>
IMHO, of_serial.c is no better than my board/chip specific code that
calls serial8250_register_port().
Really what would be ideal would be a hook to add a dev.platform_data
pointer to the appropriate struct plat_serial8250_port when the platform
device is created. It is possible that the platform bus notifiers could
be used for this. We would also want to have a way to add an
of_device_id to those recognized by 8250.c
If we did that, serial8250_probe() would automatically do the right thing.
David Daney
next prev parent reply other threads:[~2011-03-17 18:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 1:26 [RFC PATCH 0/2] serial: Hack up 8520.c for evil device tree hookin David Daney
2011-03-17 1:26 ` David Daney
[not found] ` <1300325167-26433-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-03-17 1:26 ` [RFC PATCH 1/2] serial: 8250: Add a notifier chain for driver registration David Daney
2011-03-17 1:26 ` David Daney
[not found] ` <1300325167-26433-2-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-03-17 12:18 ` Alan Cox
2011-03-17 12:18 ` Alan Cox
2011-03-17 16:42 ` David Daney
2011-03-17 18:25 ` Grant Likely
[not found] ` <20110317182510.GN9597-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-17 18:42 ` David Daney [this message]
2011-03-17 18:42 ` David Daney
2011-03-17 18:47 ` Grant Likely
[not found] ` <20110317184723.GQ9597-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-17 19:24 ` Alan Cox
2011-03-17 19:24 ` Alan Cox
2011-03-17 19:31 ` Grant Likely
[not found] ` <20110317193149.GD12824-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-17 20:13 ` David Daney
2011-03-17 20:13 ` David Daney
2011-03-17 20:31 ` Grant Likely
2011-03-17 23:48 ` Alan Cox
2011-03-17 23:48 ` Alan Cox
2011-03-18 5:18 ` Grant Likely
2011-03-17 1:26 ` [RFC PATCH 2/2] MIPS: Octeon: Use device tree to register serial ports David Daney
2011-03-17 1:26 ` David Daney
2011-03-17 18:28 ` Grant Likely
2011-03-17 18:35 ` David Daney
2011-03-17 1:46 ` [RFC PATCH 0/2] serial: Hack up 8520.c for evil device tree hookin Alan Cox
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=4D82560B.4090800@caviumnetworks.com \
--to=ddaney-m3mlkvoiwjvv6pq1l3v1odbpr1lh4cv8@public.gmane.org \
--cc=alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=gregkh-l3A5Bk7waGM@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.