* Question2: Determine subarch type
@ 2012-12-09 6:51 Alexander Shiyan
2012-12-09 9:51 ` Russell King - ARM Linux
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Shiyan @ 2012-12-09 6:51 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
How can we determine the sub-architecture type from the driver code?
For example, we are building a multi-platform kernel for subarch A and B.
One of the drivers should be used for subarch A only, and can not be used for
subarch B. So, we need to avoid load this driver for other sub-architectures.
Of course, we can check all machines in the subarch with machine_is_xx() macro,
but I think that this is not the best way to do it.
Do we have another way to do this?
--
Alexander Shiyan <shc_work@mail.ru>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Question2: Determine subarch type
2012-12-09 6:51 Question2: Determine subarch type Alexander Shiyan
@ 2012-12-09 9:51 ` Russell King - ARM Linux
2012-12-09 9:55 ` Alexander Shiyan
0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2012-12-09 9:51 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Dec 09, 2012 at 10:51:17AM +0400, Alexander Shiyan wrote:
> How can we determine the sub-architecture type from the driver code?
> For example, we are building a multi-platform kernel for subarch A and B.
> One of the drivers should be used for subarch A only, and can not be used for
> subarch B. So, we need to avoid load this driver for other sub-architectures.
> Of course, we can check all machines in the subarch with machine_is_xx() macro,
> but I think that this is not the best way to do it.
> Do we have another way to do this?
You control this by only registering the appropriate struct devices rather
than controlling this in the driver.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Question2: Determine subarch type
2012-12-09 9:51 ` Russell King - ARM Linux
@ 2012-12-09 9:55 ` Alexander Shiyan
2012-12-09 10:13 ` Russell King - ARM Linux
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Shiyan @ 2012-12-09 9:55 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, 9 Dec 2012 09:51:38 +0000
Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Sun, Dec 09, 2012 at 10:51:17AM +0400, Alexander Shiyan wrote:
> > How can we determine the sub-architecture type from the driver code?
> > For example, we are building a multi-platform kernel for subarch A and B.
> > One of the drivers should be used for subarch A only, and can not be used for
> > subarch B. So, we need to avoid load this driver for other sub-architectures.
> > Of course, we can check all machines in the subarch with machine_is_xx() macro,
> > but I think that this is not the best way to do it.
> > Do we have another way to do this?
>
> You control this by only registering the appropriate struct devices rather
> than controlling this in the driver.
Yes, but if driver is compiled as module?
--
Alexander Shiyan <shc_work@mail.ru>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Question2: Determine subarch type
2012-12-09 9:55 ` Alexander Shiyan
@ 2012-12-09 10:13 ` Russell King - ARM Linux
2012-12-09 10:24 ` Alexander Shiyan
0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2012-12-09 10:13 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Dec 09, 2012 at 01:55:51PM +0400, Alexander Shiyan wrote:
> On Sun, 9 Dec 2012 09:51:38 +0000
> Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>
> > On Sun, Dec 09, 2012 at 10:51:17AM +0400, Alexander Shiyan wrote:
> > > How can we determine the sub-architecture type from the driver code?
> > > For example, we are building a multi-platform kernel for subarch A and B.
> > > One of the drivers should be used for subarch A only, and can not be used for
> > > subarch B. So, we need to avoid load this driver for other sub-architectures.
> > > Of course, we can check all machines in the subarch with machine_is_xx() macro,
> > > but I think that this is not the best way to do it.
> > > Do we have another way to do this?
> >
> > You control this by only registering the appropriate struct devices rather
> > than controlling this in the driver.
>
> Yes, but if driver is compiled as module?
Makes no difference.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Question2: Determine subarch type
2012-12-09 10:13 ` Russell King - ARM Linux
@ 2012-12-09 10:24 ` Alexander Shiyan
2012-12-09 14:40 ` Arnd Bergmann
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Shiyan @ 2012-12-09 10:24 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, 9 Dec 2012 10:13:59 +0000
Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> > > > How can we determine the sub-architecture type from the driver code?
> > > > For example, we are building a multi-platform kernel for subarch A and B.
> > > > One of the drivers should be used for subarch A only, and can not be used for
> > > > subarch B. So, we need to avoid load this driver for other sub-architectures.
> > > > Of course, we can check all machines in the subarch with machine_is_xx() macro,
> > > > but I think that this is not the best way to do it.
> > > > Do we have another way to do this?
> > >
> > > You control this by only registering the appropriate struct devices rather
> > > than controlling this in the driver.
> >
> > Yes, but if driver is compiled as module?
>
> Makes no difference.
Do you mean that all the drivers for multi-platform targets should be
converted to platform_drivers?
OK, and what about (arch/fs/core/postcore)_initcall-s? Current multiplatform
targets use these calls.
--
Alexander Shiyan <shc_work@mail.ru>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Question2: Determine subarch type
2012-12-09 10:24 ` Alexander Shiyan
@ 2012-12-09 14:40 ` Arnd Bergmann
0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2012-12-09 14:40 UTC (permalink / raw)
To: linux-arm-kernel
On Sunday 09 December 2012, Alexander Shiyan wrote:
>
> On Sun, 9 Dec 2012 10:13:59 +0000
> Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>
> > > > > How can we determine the sub-architecture type from the driver code?
> > > > > For example, we are building a multi-platform kernel for subarch A and B.
> > > > > One of the drivers should be used for subarch A only, and can not be used for
> > > > > subarch B. So, we need to avoid load this driver for other sub-architectures.
> > > > > Of course, we can check all machines in the subarch with machine_is_xx() macro,
> > > > > but I think that this is not the best way to do it.
> > > > > Do we have another way to do this?
> > > >
> > > > You control this by only registering the appropriate struct devices rather
> > > > than controlling this in the driver.
> > >
> > > Yes, but if driver is compiled as module?
> >
> > Makes no difference.
>
> Do you mean that all the drivers for multi-platform targets should be
> converted to platform_drivers?
Right, if you have drivers that just use hardware directly rather than
registering a 'struct device_driver' of some sort, they should be
converted. We did most of those conversions during linux-2.5 over
ten years ago, but a few may have slipped through into 2.6 and 3.x.
> OK, and what about (arch/fs/core/postcore)_initcall-s? Current multiplatform
> targets use these calls.
These all need to be audited and get extra checks to make sure they
only execute on hardware they are written for. Shawn Guo did a lot
of work in that area recently.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-12-09 14:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-09 6:51 Question2: Determine subarch type Alexander Shiyan
2012-12-09 9:51 ` Russell King - ARM Linux
2012-12-09 9:55 ` Alexander Shiyan
2012-12-09 10:13 ` Russell King - ARM Linux
2012-12-09 10:24 ` Alexander Shiyan
2012-12-09 14:40 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox