Guys,
I was wondering if there was any issue in changing platform_device_add to
use insert_resource instead of request_resource. The reason for this
change is to handle several cases where we have device registers that
overlap that two different drivers are handling.
The biggest case of this is with ethernet on a number of PowerPC based
systems where a subset of the ethernet controllers registers are used for
MDIO/PHY bus control. We currently hack around the limitation by having
the MDIO/PHY bus not actually register an memory resource region.
If the following looks good I'll send a more formal patch.
-- kumar
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -257,7 +257,7 @@ int platform_device_add(struct platform_
p = &ioport_resource;
}
- if (p && request_resource(p, r)) {
+ if (p && insert_resource(p, r)) {
printk(KERN_ERR
"%s: failed to claim resource %d\n",
pdev->dev.bus_id, i);
On Tue, Nov 15, 2005 at 05:31:57PM -0600, Kumar Gala wrote:
> Guys,
>
> I was wondering if there was any issue in changing platform_device_add to
> use insert_resource instead of request_resource. The reason for this
> change is to handle several cases where we have device registers that
> overlap that two different drivers are handling.
>
> The biggest case of this is with ethernet on a number of PowerPC based
> systems where a subset of the ethernet controllers registers are used for
> MDIO/PHY bus control. We currently hack around the limitation by having
> the MDIO/PHY bus not actually register an memory resource region.
>
> If the following looks good I'll send a more formal patch.
Looks good to me, but Russell knows this code much better than I.
thanks,
greg k-h
On Nov 16, 2005, at 12:41 AM, Greg KH wrote:
> On Tue, Nov 15, 2005 at 05:31:57PM -0600, Kumar Gala wrote:
>> Guys,
>>
>> I was wondering if there was any issue in changing
>> platform_device_add to
>> use insert_resource instead of request_resource. The reason for this
>> change is to handle several cases where we have device registers that
>> overlap that two different drivers are handling.
>>
>> The biggest case of this is with ethernet on a number of PowerPC
>> based
>> systems where a subset of the ethernet controllers registers are
>> used for
>> MDIO/PHY bus control. We currently hack around the limitation by
>> having
>> the MDIO/PHY bus not actually register an memory resource region.
>>
>> If the following looks good I'll send a more formal patch.
>
> Looks good to me, but Russell knows this code much better than I.
>
> thanks,
>
> greg k-h
Russell, any issues?
- kumar
On Thu, Nov 17, 2005 at 09:36:38AM -0600, Kumar Gala wrote:
>
> On Nov 16, 2005, at 12:41 AM, Greg KH wrote:
>
> >On Tue, Nov 15, 2005 at 05:31:57PM -0600, Kumar Gala wrote:
> >>Guys,
> >>
> >>I was wondering if there was any issue in changing
> >>platform_device_add to
> >>use insert_resource instead of request_resource. The reason for this
> >>change is to handle several cases where we have device registers that
> >>overlap that two different drivers are handling.
> >>
> >>The biggest case of this is with ethernet on a number of PowerPC
> >>based
> >>systems where a subset of the ethernet controllers registers are
> >>used for
> >>MDIO/PHY bus control. We currently hack around the limitation by
> >>having
> >>the MDIO/PHY bus not actually register an memory resource region.
> >>
> >>If the following looks good I'll send a more formal patch.
> >
> >Looks good to me, but Russell knows this code much better than I.
> >
> >thanks,
> >
> >greg k-h
>
> Russell, any issues?
Haven't managed to look at this yet - busy catching up after illness.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
On Nov 17, 2005, at 9:49 AM, Russell King wrote:
> On Thu, Nov 17, 2005 at 09:36:38AM -0600, Kumar Gala wrote:
>>
>> On Nov 16, 2005, at 12:41 AM, Greg KH wrote:
>>
>>> On Tue, Nov 15, 2005 at 05:31:57PM -0600, Kumar Gala wrote:
>>>> Guys,
>>>>
>>>> I was wondering if there was any issue in changing
>>>> platform_device_add to
>>>> use insert_resource instead of request_resource. The reason for
>>>> this
>>>> change is to handle several cases where we have device registers
>>>> that
>>>> overlap that two different drivers are handling.
>>>>
>>>> The biggest case of this is with ethernet on a number of PowerPC
>>>> based
>>>> systems where a subset of the ethernet controllers registers are
>>>> used for
>>>> MDIO/PHY bus control. We currently hack around the limitation by
>>>> having
>>>> the MDIO/PHY bus not actually register an memory resource region.
>>>>
>>>> If the following looks good I'll send a more formal patch.
>>>
>>> Looks good to me, but Russell knows this code much better than I.
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>> Russell, any issues?
>
> Haven't managed to look at this yet - busy catching up after illness.
Any update?
- kumar
On Wed, Nov 23, 2005 at 12:57:40AM -0600, Kumar Gala wrote:
> Any update?
It should be okay, but I'll step back from saying "safe" because
I don't particularly like the insert_resource() concept.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
On Wed, 23 Nov 2005, Russell King wrote:
> On Wed, Nov 23, 2005 at 12:57:40AM -0600, Kumar Gala wrote:
> > Any update?
>
> It should be okay, but I'll step back from saying "safe" because
> I don't particularly like the insert_resource() concept.
Ok. Not sure how to take that. Would you prefer we work around this some
other way? or your willing to take a patch but just hesitant about it
breaking something?
- kumar
On Wed, Nov 23, 2005 at 12:48:55PM -0600, Kumar Gala wrote:
> On Wed, 23 Nov 2005, Russell King wrote:
>
> > On Wed, Nov 23, 2005 at 12:57:40AM -0600, Kumar Gala wrote:
> > > Any update?
> >
> > It should be okay, but I'll step back from saying "safe" because
> > I don't particularly like the insert_resource() concept.
>
> Ok. Not sure how to take that. Would you prefer we work around this some
> other way? or your willing to take a patch but just hesitant about it
> breaking something?
PCI survived this change, so I've no doubt that platform devices will
survive. I just don't like it on a personal level because I worry
about the possibility of inappropriately inserting a resource above
some other resource.
Theoretically, if you have two platform devices which are mutually
exclusive, but use exactly the same resource range, with the existing
system only one will succeed. My understanding of insert_resource
indicates that both will succeed, and you'll end up with one below
the other.
That's not too much of a problem as long as the drivers also request
the resources before using them.
But that's theory. I don't know of any situation today where this
is presently true, or would be.
In the end, we can't have your behaviour without also having the
_possibility_ of this problem. So let's have your behaviour as
it fixes a real problem you're seeing.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core