All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Using common code for csiostor.
@ 2014-12-17 15:51 Praveen Madhavan
  2014-12-17 16:10 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Praveen Madhavan @ 2014-12-17 15:51 UTC (permalink / raw
  To: hch@infradead.org; +Cc: linux-scsi@vger.kernel.org

Hi Christoph,
csiostor is chelsio full offload FCoE physical function driver. I would like to reuse common hardware interface functions defined in t4_hw.c of chelsio networking driver(cxgb4). Below is makefile change that creates softlink to t4_hw.c and builds the same. Is this change is acceptable? Please suggest if there is any better way of doing this.

diff --git a/drivers/scsi/csiostor/Makefile b/drivers/scsi/csiostor/Makefile
index 913b9a9..74117f3 100644
--- a/drivers/scsi/csiostor/Makefile
+++ b/drivers/scsi/csiostor/Makefile
@@ -5,8 +5,9 @@

 ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb4

 obj-$(CONFIG_SCSI_CHELSIO_FCOE) := csiostor.o
 csiostor-objs := csio_attr.o csio_init.o csio_lnode.o csio_scsi.o \
                csio_hw.o csio_hw_t4.o csio_hw_t5.o csio_isr.o \
-               csio_mb.o csio_rnode.o csio_wr.o
+               csio_mb.o csio_rnode.o csio_wr.o t4_hw.o
+$(obj)/t4_hw.c:
+       ln -sf $(srctree)/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c $(obj)/t4_hw.c

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Using common code for csiostor.
  2014-12-17 15:51 Using common code for csiostor Praveen Madhavan
@ 2014-12-17 16:10 ` James Bottomley
  2014-12-30 12:23   ` hch
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2014-12-17 16:10 UTC (permalink / raw
  To: Praveen Madhavan; +Cc: hch@infradead.org, linux-scsi@vger.kernel.org

On Wed, 2014-12-17 at 15:51 +0000, Praveen Madhavan wrote:
> Hi Christoph,
> csiostor is chelsio full offload FCoE physical function driver. I
> would like to reuse common hardware interface functions defined in
> t4_hw.c of chelsio networking driver(cxgb4). Below is makefile change
> that creates softlink to t4_hw.c and builds the same. Is this change
> is acceptable? Please suggest if there is any better way of doing
> this.

The usual way to do this is to make the common hardware function a base
module and make all drivers that use it depend on it.  Like iwldvm ->
iwlwifi -> mac80211 etc.

We really wouldn't want to do the link and build because that will
create two identical binary copies of the interface (one in SCSI and one
in net) which is a waste of text space.

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using common code for csiostor.
  2014-12-17 16:10 ` James Bottomley
@ 2014-12-30 12:23   ` hch
  0 siblings, 0 replies; 3+ messages in thread
From: hch @ 2014-12-30 12:23 UTC (permalink / raw
  To: James Bottomley
  Cc: Praveen Madhavan, hch@infradead.org, linux-scsi@vger.kernel.org

On Wed, Dec 17, 2014 at 08:10:15AM -0800, James Bottomley wrote:
> The usual way to do this is to make the common hardware function a base
> module and make all drivers that use it depend on it.  Like iwldvm ->
> iwlwifi -> mac80211 etc.
> 
> We really wouldn't want to do the link and build because that will
> create two identical binary copies of the interface (one in SCSI and one
> in net) which is a waste of text space.

Agreed.  If the amount of shared code is really small a header with
inlines might be an alternative as there is some overhead creating a new
module.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-30 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17 15:51 Using common code for csiostor Praveen Madhavan
2014-12-17 16:10 ` James Bottomley
2014-12-30 12:23   ` hch

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.