[PATCH] fix inlining trouble causing build failure indrivers/scsi/qla2xxx/qla_os.c

From: Jesper Juhl
Date: Sun Sep 19 2004 - 16:54:10 EST



2.6.9-rc2-bk5 allyesconfig fails to build for me with gcc 3.4.1 with the
following error :

CC drivers/scsi/qla2xxx/qla_os.o
drivers/scsi/qla2xxx/qla_os.c: In function `qla2x00_queuecommand':
drivers/scsi/qla2xxx/qla_os.c:315: sorry, unimplemented: inlining failed in call to 'qla2x00_callback': function not considered for inlining
drivers/scsi/qla2xxx/qla_os.c:269: sorry, unimplemented: called from here
drivers/scsi/qla2xxx/qla_os.c:315: sorry, unimplemented: inlining failed in call to 'qla2x00_callback': function not considered for inlining
drivers/scsi/qla2xxx/qla_os.c:269: sorry, unimplemented: called from here
make[3]: *** [drivers/scsi/qla2xxx/qla_os.o] Error 1
make[2]: *** [drivers/scsi/qla2xxx] Error 2
make[1]: *** [drivers/scsi] Error 2
make: *** [drivers] Error 2

Here's a patch to fix this by simply moving the function.
An alternative fix would be to uninline the function.

Since I don't have the hardware I have only been able to compile test this
patch, but it's fairly trivial in nature so I can't imagine anything
breaking from this small change.

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>


diff -up linux-2.6.9-rc2-bk5-orig/drivers/scsi/qla2xxx/qla_os.c linux-2.6.9-rc2-bk5/drivers/scsi/qla2xxx/qla_os.c
--- linux-2.6.9-rc2-bk5-orig/drivers/scsi/qla2xxx/qla_os.c 2004-09-14 23:19:38.000000000 +0200
+++ linux-2.6.9-rc2-bk5/drivers/scsi/qla2xxx/qla_os.c 2004-09-19 23:46:19.000000000 +0200
@@ -229,73 +229,11 @@ qla2x00_stop_timer(scsi_qla_host_t *ha)

void qla2x00_cmd_timeout(srb_t *);

-static __inline__ void qla2x00_callback(scsi_qla_host_t *, struct scsi_cmnd *);
static __inline__ void sp_put(struct scsi_qla_host * ha, srb_t *sp);
static __inline__ void sp_get(struct scsi_qla_host * ha, srb_t *sp);
static __inline__ void
qla2x00_delete_from_done_queue(scsi_qla_host_t *, srb_t *);

-/**************************************************************************
-* sp_put
-*
-* Description:
-* Decrement reference count and call the callback if we're the last
-* owner of the specified sp. Will get the host_lock before calling
-* the callback.
-*
-* Input:
-* ha - pointer to the scsi_qla_host_t where the callback is to occur.
-* sp - pointer to srb_t structure to use.
-*
-* Returns:
-*
-**************************************************************************/
-static inline void
-sp_put(struct scsi_qla_host * ha, srb_t *sp)
-{
- if (atomic_read(&sp->ref_count) == 0) {
- qla_printk(KERN_INFO, ha,
- "%s(): **** SP->ref_count not zero\n",
- __func__);
- DEBUG2(BUG();)
-
- return;
- }
-
- if (!atomic_dec_and_test(&sp->ref_count)) {
- return;
- }
-
- qla2x00_callback(ha, sp->cmd);
-}
-
-/**************************************************************************
-* sp_get
-*
-* Description:
-* Increment reference count of the specified sp.
-*
-* Input:
-* sp - pointer to srb_t structure to use.
-*
-* Returns:
-*
-**************************************************************************/
-static inline void
-sp_get(struct scsi_qla_host * ha, srb_t *sp)
-{
- atomic_inc(&sp->ref_count);
-
- if (atomic_read(&sp->ref_count) > 2) {
- qla_printk(KERN_INFO, ha,
- "%s(): **** SP->ref_count greater than two\n",
- __func__);
- DEBUG2(BUG();)
-
- return;
- }
-}
-
/*
* qla2x00_callback
* Returns the completed SCSI command to LINUX.
@@ -366,6 +304,67 @@ qla2x00_callback(scsi_qla_host_t *ha, st
(*(cmd)->scsi_done)(cmd);
}

+/**************************************************************************
+* sp_put
+*
+* Description:
+* Decrement reference count and call the callback if we're the last
+* owner of the specified sp. Will get the host_lock before calling
+* the callback.
+*
+* Input:
+* ha - pointer to the scsi_qla_host_t where the callback is to occur.
+* sp - pointer to srb_t structure to use.
+*
+* Returns:
+*
+**************************************************************************/
+static inline void
+sp_put(struct scsi_qla_host * ha, srb_t *sp)
+{
+ if (atomic_read(&sp->ref_count) == 0) {
+ qla_printk(KERN_INFO, ha,
+ "%s(): **** SP->ref_count not zero\n",
+ __func__);
+ DEBUG2(BUG();)
+
+ return;
+ }
+
+ if (!atomic_dec_and_test(&sp->ref_count)) {
+ return;
+ }
+
+ qla2x00_callback(ha, sp->cmd);
+}
+
+/**************************************************************************
+* sp_get
+*
+* Description:
+* Increment reference count of the specified sp.
+*
+* Input:
+* sp - pointer to srb_t structure to use.
+*
+* Returns:
+*
+**************************************************************************/
+static inline void
+sp_get(struct scsi_qla_host * ha, srb_t *sp)
+{
+ atomic_inc(&sp->ref_count);
+
+ if (atomic_read(&sp->ref_count) > 2) {
+ qla_printk(KERN_INFO, ha,
+ "%s(): **** SP->ref_count greater than two\n",
+ __func__);
+ DEBUG2(BUG();)
+
+ return;
+ }
+}
+
static inline void
qla2x00_delete_from_done_queue(scsi_qla_host_t *dest_ha, srb_t *sp)
{


--
Jesper Juhl <juhl-lkml@xxxxxx>


PS. I'm not subscribed to linux-scsi, so please CC me on replies from there.


-
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/