Re: [2.6 patch] SCSI tmscsim.c: fix inline compile errors

From: Guennadi Liakhovetski
Date: Fri Jul 16 2004 - 16:48:26 EST


Hi

On Fri, 16 Jul 2004, Adrian Bunk wrote:

Trying to compile drivers/scsi/tmscsim.c in 2.6.8-rc1-mm1 using gcc 3.4
results in compile errors starting with the following:

<-- snip -->

...
CC drivers/scsi/tmscsim.o
In file included from drivers/scsi/tmscsim.c:1477:
drivers/scsi/scsiiom.c: In function `do_DC390_Interrupt':
drivers/scsi/tmscsim.c:295: sorry, unimplemented: inlining failed in
call to 'dc390_InvalidCmd': function body not available
drivers/scsi/scsiiom.c:279: sorry, unimplemented: called from here
drivers/scsi/tmscsim.c:296: sorry, unimplemented: inlining failed in
call to 'dc390_EnableMsgOut_Abort': function body not available
drivers/scsi/scsiiom.c:317: sorry, unimplemented: called from here
make[2]: *** [drivers/scsi/tmscsim.o] Error 1

<-- snip -->


The patch below removes the inlines from the affected functions.

An alternative approach would be to move the functions above the place
where they are called the first time.

Thanks for the patch!

I looked at those 3 functions. dc390_EnableMsgOut_Abort is called 5 times in the code and is 0x30 bytes long (as compiled with 3.3.2), so, uninlining it, probably, makes most sense. The other 2 functions are called only ones each and from the interrupt, so, I applied the "alternative approach" to them - moved above the calling functions. So, if there are no objections, perhaps, the attached patch could be applied instead of yours. Tested.

Thanks
Guennadi




diffstat output:
drivers/scsi/scsiiom.c | 6 +++---
drivers/scsi/tmscsim.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)


Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>

--- linux-2.6.7-mm6-full-gcc3.4/drivers/scsi/scsiiom.c.old 2004-07-09 01:31:13.000000000 +0200
+++ linux-2.6.7-mm6-full-gcc3.4/drivers/scsi/scsiiom.c 2004-07-09 01:33:35.000000000 +0200
@@ -594,7 +594,7 @@
}

/* abort command */
-static void __inline__
+static void
dc390_EnableMsgOut_Abort ( struct dc390_acb* pACB, struct dc390_srb* pSRB )
{
pSRB->MsgOutBuf[0] = ABORT;
@@ -1656,7 +1656,7 @@
}


-static void __inline__
+static void
dc390_RequestSense( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
{
struct scsi_cmnd *pcmd;
@@ -1696,7 +1696,7 @@



-static void __inline__
+static void
dc390_InvalidCmd( struct dc390_acb* pACB )
{
if( pACB->pActiveDCB->pActiveSRB->SRBState & (SRB_START_+SRB_MSGOUT) )
--- linux-2.6.7-mm6-full-gcc3.4/drivers/scsi/tmscsim.c.old 2004-07-09 01:29:36.000000000 +0200
+++ linux-2.6.7-mm6-full-gcc3.4/drivers/scsi/tmscsim.c 2004-07-09 01:33:46.000000000 +0200
@@ -291,9 +291,9 @@
static void dc390_DoingSRB_Done( struct dc390_acb* pACB, struct scsi_cmnd * cmd);
static void dc390_ScsiRstDetect( struct dc390_acb* pACB );
static void dc390_ResetSCSIBus( struct dc390_acb* pACB );
-static void __inline__ dc390_RequestSense( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB );
-static void __inline__ dc390_InvalidCmd( struct dc390_acb* pACB );
-static void __inline__ dc390_EnableMsgOut_Abort (struct dc390_acb*, struct dc390_srb*);
+static void dc390_RequestSense( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB );
+static void dc390_InvalidCmd( struct dc390_acb* pACB );
+static void dc390_EnableMsgOut_Abort (struct dc390_acb*, struct dc390_srb*);
static irqreturn_t do_DC390_Interrupt( int, void *, struct pt_regs *);

static int dc390_initAdapter(struct Scsi_Host *psh, unsigned long io_port, u8 Irq, u8 index );

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



---
Guennadi Liakhovetski
Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>
Modified and
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>

diff -u a/drivers/scsi/scsiiom.c b/drivers/scsi/scsiiom.c
--- a/drivers/scsi/scsiiom.c Fri Jul 16 22:42:38 2004
+++ b/drivers/scsi/scsiiom.c Fri Jul 16 22:58:28 2004
@@ -213,8 +213,17 @@
}
#endif

+
+static void __inline__
+dc390_InvalidCmd(struct dc390_acb* pACB)
+{
+ if (pACB->pActiveDCB->pActiveSRB->SRBState & (SRB_START_ | SRB_MSGOUT))
+ DC390_write8(ScsiCmd, CLEAR_FIFO_CMD);
+}
+
+
static irqreturn_t __inline__
-DC390_Interrupt( int irq, void *dev_id, struct pt_regs *regs)
+DC390_Interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct dc390_acb *pACB, *pACB2;
struct dc390_dcb *pDCB;
@@ -594,7 +603,7 @@
}

/* abort command */
-static void __inline__
+static void
dc390_EnableMsgOut_Abort ( struct dc390_acb* pACB, struct dc390_srb* pSRB )
{
pSRB->MsgOutBuf[0] = ABORT;
@@ -1333,6 +1342,35 @@
}


+static void __inline__
+dc390_RequestSense(struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB)
+{
+ struct scsi_cmnd *pcmd;
+
+ pcmd = pSRB->pcmd;
+
+ REMOVABLEDEBUG(printk(KERN_INFO "DC390: RequestSense(Cmd %02x, Id %02x, LUN %02x)\n",\
+ pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN));
+
+ pSRB->SRBFlag |= AUTO_REQSENSE;
+ pSRB->SavedSGCount = pcmd->use_sg;
+ pSRB->SavedTotXLen = pSRB->TotalXferredLen;
+ pSRB->AdaptStatus = 0;
+ pSRB->TargetStatus = 0; /* CHECK_CONDITION<<1; */
+
+ /* We are called from SRBdone, original PCI mapping has been removed
+ * already, new one is set up from StartSCSI */
+ pSRB->SGIndex = 0;
+
+ pSRB->TotalXferredLen = 0;
+ pSRB->SGToBeXferLen = 0;
+ if (dc390_StartSCSI(pACB, pDCB, pSRB)) {
+ dc390_Going_to_Waiting(pDCB, pSRB);
+ dc390_waiting_timer(pACB, HZ/5);
+ }
+}
+
+
static void
dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
{
@@ -1649,52 +1687,4 @@
dc390_Waiting_process( pACB );
}
return;
-}
-
-
-static void __inline__
-dc390_RequestSense( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
-{
- struct scsi_cmnd *pcmd;
-
- pcmd = pSRB->pcmd;
-
- REMOVABLEDEBUG(printk (KERN_INFO "DC390: RequestSense (Cmd %02x, Id %02x, LUN %02x)\n",\
- pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN));
-
- pSRB->SRBFlag |= AUTO_REQSENSE;
- //pSRB->Segment0[0] = (u32) pSRB->CmdBlock[0];
- //pSRB->Segment0[1] = (u32) pSRB->CmdBlock[4];
- //pSRB->Segment1[0] = ((u32)(pcmd->cmd_len) << 8) + pSRB->SGcount;
- //pSRB->Segment1[1] = pSRB->TotalXferredLen;
- pSRB->SavedSGCount = pcmd->use_sg;
- pSRB->SavedTotXLen = pSRB->TotalXferredLen;
- pSRB->AdaptStatus = 0;
- pSRB->TargetStatus = 0; /* CHECK_CONDITION<<1; */
-
- /* We are called from SRBdone, original PCI mapping has been removed
- * already, new one is set up from StartSCSI */
- pSRB->SGIndex = 0;
-
- //pSRB->CmdBlock[0] = REQUEST_SENSE;
- //pSRB->CmdBlock[1] = pDCB->TargetLUN << 5;
- //(u16) pSRB->CmdBlock[2] = 0;
- //(u16) pSRB->CmdBlock[4] = sizeof(pcmd->sense_buffer);
- //pSRB->ScsiCmdLen = 6;
-
- pSRB->TotalXferredLen = 0;
- pSRB->SGToBeXferLen = 0;
- if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) {
- dc390_Going_to_Waiting ( pDCB, pSRB );
- dc390_waiting_timer (pACB, HZ/5);
- }
-}
-
-
-
-static void __inline__
-dc390_InvalidCmd( struct dc390_acb* pACB )
-{
- if( pACB->pActiveDCB->pActiveSRB->SRBState & (SRB_START_+SRB_MSGOUT) )
- DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
}
diff -u a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
--- a/drivers/scsi/tmscsim.c Fri Jul 16 22:40:41 2004
+++ b/drivers/scsi/tmscsim.c Fri Jul 16 23:01:08 2004
@@ -289,9 +289,7 @@
static void dc390_DoingSRB_Done( struct dc390_acb* pACB, struct scsi_cmnd * cmd);
static void dc390_ScsiRstDetect( struct dc390_acb* pACB );
static void dc390_ResetSCSIBus( struct dc390_acb* pACB );
-static void __inline__ dc390_RequestSense( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB );
-static void __inline__ dc390_InvalidCmd( struct dc390_acb* pACB );
-static void __inline__ dc390_EnableMsgOut_Abort (struct dc390_acb*, struct dc390_srb*);
+static void dc390_EnableMsgOut_Abort(struct dc390_acb*, struct dc390_srb*);
static irqreturn_t do_DC390_Interrupt( int, void *, struct pt_regs *);

static int dc390_initAdapter(struct Scsi_Host *psh, unsigned long io_port, u8 Irq, u8 index );
@@ -939,8 +937,6 @@
{
pSRB->pSRBDCB = pDCB;
pSRB->pcmd = pcmd;
- //pSRB->ScsiCmdLen = pcmd->cmd_len;
- //memcpy (pSRB->CmdBlock, pcmd->cmnd, pcmd->cmd_len);

pSRB->SGIndex = 0;
pSRB->AdaptStatus = 0;