* Source organization for two drivers sharing coomon code
@ 2007-07-27 17:17 Subbu Seetharaman
2007-07-27 17:35 ` Alan Cox
2007-07-27 19:03 ` Jan Engelhardt
0 siblings, 2 replies; 6+ messages in thread
From: Subbu Seetharaman @ 2007-07-27 17:17 UTC (permalink / raw)
To: linux-kernel
What is the recommended way for two drivers to share common code ?
Our device has two PCI functions and hence two drivers - NIC and
SCSI driver. The source code for these dirvers will fit under
drivers/net and drivers/scsi. But both drivers share some common
code. If possible, I would like to avoid duplicating the common
code under the two driver directories. Is there any recommened
way to organize such common code ? Thanks.
Subbu
___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of
ServerEngines LLC and is intended only for the designated recipient(s) named above. Any unauthorized
review, printing, retention, copying, disclosure or distribution is strictly prohibited. If you are not the
intended recipient of this message, please immediately advise the sender by reply email message and
delete all copies of this message and any attachment(s). Thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Source organization for two drivers sharing coomon code
2007-07-27 17:17 Source organization for two drivers sharing coomon code Subbu Seetharaman
@ 2007-07-27 17:35 ` Alan Cox
2007-07-27 19:03 ` Jan Engelhardt
1 sibling, 0 replies; 6+ messages in thread
From: Alan Cox @ 2007-07-27 17:35 UTC (permalink / raw)
To: Subbu Seetharaman; +Cc: linux-kernel
On Fri, 27 Jul 2007 10:17:29 -0700
"Subbu Seetharaman" <subbus@serverengines.com> wrote:
>
>
> What is the recommended way for two drivers to share common code ?
> Our device has two PCI functions and hence two drivers - NIC and
> SCSI driver. The source code for these dirvers will fit under
> drivers/net and drivers/scsi. But both drivers share some common
> code. If possible, I would like to avoid duplicating the common
> code under the two driver directories. Is there any recommened
> way to organize such common code ? Thanks.
What sort of code is shared - historically the cases we have had in the
driver space have mostly been common message passing interfaces to
co-processor type boards (eg I2O or MPT Fusion) and those have lived
under drivers/message/type/...
I don't think there is any hard rule here.
Alan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Source organization for two drivers sharing coomon code
2007-07-27 17:17 Source organization for two drivers sharing coomon code Subbu Seetharaman
2007-07-27 17:35 ` Alan Cox
@ 2007-07-27 19:03 ` Jan Engelhardt
2007-07-27 19:12 ` Chris Friesen
1 sibling, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2007-07-27 19:03 UTC (permalink / raw)
To: Subbu Seetharaman; +Cc: linux-kernel
On Jul 27 2007 10:17, Subbu Seetharaman wrote:
>What is the recommended way for two drivers to share common code ?
>Our device has two PCI functions and hence two drivers - NIC and
>SCSI driver. The source code for these dirvers will fit under
>drivers/net and drivers/scsi. But both drivers share some common
>code. If possible, I would like to avoid duplicating the common
>code under the two driver directories. Is there any recommened
>way to organize such common code ? Thanks.
You could create (in total) three modules, e.g. my-common.ko,
my-net.ko and my-scsi.ko, of which the latter two use functions from the first.
Jan
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Source organization for two drivers sharing coomon code
2007-07-27 19:03 ` Jan Engelhardt
@ 2007-07-27 19:12 ` Chris Friesen
2007-07-27 19:34 ` Jan Engelhardt
0 siblings, 1 reply; 6+ messages in thread
From: Chris Friesen @ 2007-07-27 19:12 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Subbu Seetharaman, linux-kernel
Jan Engelhardt wrote:
> On Jul 27 2007 10:17, Subbu Seetharaman wrote:
>
>>What is the recommended way for two drivers to share common code ?
>><snip>...The source code for these dirvers will fit under
>>drivers/net and drivers/scsi. But both drivers share some common
>>code.
> You could create (in total) three modules, e.g. my-common.ko,
> my-net.ko and my-scsi.ko, of which the latter two use functions from the first.
Where would the common code live, in such a case? Would you just pick
one of the two locations at random, or put it in drivers/misc or maybe lib?
Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Source organization for two drivers sharing coomon code
2007-07-27 19:12 ` Chris Friesen
@ 2007-07-27 19:34 ` Jan Engelhardt
0 siblings, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2007-07-27 19:34 UTC (permalink / raw)
To: Chris Friesen; +Cc: Subbu Seetharaman, linux-kernel
On Jul 27 2007 13:12, Chris Friesen wrote:
> Jan Engelhardt wrote:
>> On Jul 27 2007 10:17, Subbu Seetharaman wrote:
>>
>> >What is the recommended way for two drivers to share common code ?
>> ><snip>...The source code for these dirvers will fit under drivers/net and
>> >drivers/scsi. But both drivers share some common code.
>
>> You could create (in total) three modules, e.g. my-common.ko,
>> my-net.ko and my-scsi.ko, of which the latter two use functions from the
>> first.
>
> Where would the common code live, in such a case? Would you just pick one of
> the two locations at random, or put it in drivers/misc or maybe lib?
Perhaps drivers/message - well I can't answer that exactly.
As far as the output object files are concerned, it is not relevant,
since they will be autoloaded anyway :)
Jan
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Source organization for two drivers sharing coomon code
@ 2007-07-28 2:42 Subbu Seetharaman
0 siblings, 0 replies; 6+ messages in thread
From: Subbu Seetharaman @ 2007-07-28 2:42 UTC (permalink / raw)
To: Jan Engelhardt, Chris Friesen, alan; +Cc: linux-kernel
Thanks for all the answers. The common code is mostly handling
the message passing for hardware initialization, rings creation
and some ioctls. drivers/message looks like a good place for this
code to live.
Subbu
From: Jan Engelhardt [mailto:jengelh@computergmbh.de]
To: Chris Friesen [mailto:cfriesen@nortel.com]
Cc: Subbu Seetharaman [mailto:subbus@serverengines.com], linux-kernel@vger.kernel.org
Sent: Fri, 27 Jul 2007 12:34:16 -0700
Subject: Re: Source organization for two drivers sharing coomon code
On Jul 27 2007 13:12, Chris Friesen wrote:
> Jan Engelhardt wrote:
>> On Jul 27 2007 10:17, Subbu Seetharaman wrote:
>>
>> >What is the recommended way for two drivers to share common code ?
>> ><snip>...The source code for these dirvers will fit under drivers/net and
>> >drivers/scsi. But both drivers share some common code.
>
>> You could create (in total) three modules, e.g. my-common.ko,
>> my-net.ko and my-scsi.ko, of which the latter two use functions from the
>> first.
>
> Where would the common code live, in such a case? Would you just pick one of
> the two locations at random, or put it in drivers/misc or maybe lib?
Perhaps drivers/message - well I can't answer that exactly.
As far as the output object files are concerned, it is not relevant,
since they will be autoloaded anyway :)
Jan
--
___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of
ServerEngines LLC and is intended only for the designated recipient(s) named above. Any unauthorized
review, printing, retention, copying, disclosure or distribution is strictly prohibited. If you are not the
intended recipient of this message, please immediately advise the sender by reply email message and
delete all copies of this message and any attachment(s). Thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-07-28 2:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 17:17 Source organization for two drivers sharing coomon code Subbu Seetharaman
2007-07-27 17:35 ` Alan Cox
2007-07-27 19:03 ` Jan Engelhardt
2007-07-27 19:12 ` Chris Friesen
2007-07-27 19:34 ` Jan Engelhardt
-- strict thread matches above, loose matches on Subject: below --
2007-07-28 2:42 Subbu Seetharaman
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.