[patch] megaraid: fix CONFIG_PROC_FS compile errors
From: David Rientjes
Date: Mon Apr 30 2007 - 10:36:40 EST
Only declare mega_proc_dir_entry() in CONFIG_PROC_FS. We should call
mega_create_proc_entry() only in this configuration so make sure it's defined
if we call it.
Only define mega_adapinq() in CONFIG_PROC_FS. mega_internal_dev_inquiry()
and mega_print_inquiry() were never declared without CONFIG_PROC_FS so
make sure we don't have prototypes for them if we aren't going to define
them.
Move the declaration of 'buf' in mega_remove_one() because we only use it
in the CONFIG_PROC_FS case.
Cc: Neela Kolli <Neela.Kolli@xxxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
---
drivers/scsi/megaraid.c | 10 +++++++++-
drivers/scsi/megaraid.h | 5 +++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -84,7 +84,10 @@ MODULE_PARM_DESC(max_mbox_busy_wait, "Maximum wait for mailbox in microseconds i
static int hba_count;
static adapter_t *hba_soft_state[MAX_CONTROLLERS];
+
+#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *mega_proc_dir_entry;
+#endif
/* For controller re-ordering */
static struct mega_hbas mega_hbas[MAX_CONTROLLERS];
@@ -4342,6 +4345,7 @@ mega_support_cluster(adapter_t *adapter)
return 0;
}
+#ifdef CONFIG_PROC_FS
/**
* mega_adapinq()
@@ -4448,6 +4452,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
return rval;
}
+#endif
/**
* mega_internal_command()
@@ -4890,7 +4895,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_drvdata(pdev, host);
+#ifdef CONFIG_PROC_FS
mega_create_proc_entry(hba_count, mega_proc_dir_entry);
+#endif
error = scsi_add_host(host, &pdev->dev);
if (error)
@@ -4965,7 +4972,6 @@ megaraid_remove_one(struct pci_dev *pdev)
{
struct Scsi_Host *host = pci_get_drvdata(pdev);
adapter_t *adapter = (adapter_t *)host->hostdata;
- char buf[12] = { 0 };
scsi_remove_host(host);
@@ -4982,6 +4988,8 @@ megaraid_remove_one(struct pci_dev *pdev)
#ifdef CONFIG_PROC_FS
if (adapter->controller_proc_dir_entry) {
+ char buf[12] = { 0 };
+
remove_proc_entry("stat", adapter->controller_proc_dir_entry);
remove_proc_entry("config",
adapter->controller_proc_dir_entry);
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -1002,7 +1002,9 @@ static int megaraid_reset(Scsi_Cmnd *);
static int megaraid_abort_and_reset(adapter_t *, Scsi_Cmnd *, int);
static int megaraid_biosparam(struct scsi_device *, struct block_device *,
sector_t, int []);
+#ifdef CONFIG_PROC_FS
static int mega_print_inquiry(char *, char *);
+#endif
static int mega_build_sglist (adapter_t *adapter, scb_t *scb,
u32 *buffer, u32 *length);
@@ -1040,10 +1042,9 @@ static int proc_rdrv_20(char *, char **, off_t, int, int *, void *);
static int proc_rdrv_30(char *, char **, off_t, int, int *, void *);
static int proc_rdrv_40(char *, char **, off_t, int, int *, void *);
static int proc_rdrv(adapter_t *, char *, int, int);
-#endif
-
static int mega_adapinq(adapter_t *, dma_addr_t);
static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t);
+#endif
static int mega_support_ext_cdb(adapter_t *);
static mega_passthru* mega_prepare_passthru(adapter_t *, scb_t *,
-
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/