2010-07-21 13:57:40

by Christian Dietrich

[permalink] [raw]
Subject: [PATCH 0/3] Removing dead code (also drivers/scsi/arm/acornsci.c)

Hi all!

As part of the VAMOS[0] research project at the University of
Erlangen we are looking at multiple integrity errors in linux'
configuration system.

I've been running a check on the drivers/scsi sourcetree for
config Items not defined in Kconfig and found 3 such cases. Sourcecode
blocks depending on these Items are not reachable from a vanilla
kernel -- dead code. I've seen such dead blocks made on purpose
e.g. while integrating new features into the kernel but generally
they're just useless.

Each of the patches in this patchset removes on such dead
config Item, I'd be glad if you consider applying them. I've been
doing deeper analysis of such issues before and can do so again but
I'm not so sure they were fastly usefull.

I build the patches against a vanilla kernel in order to
try if the kernel compiles with this patches

Please keep me informed of this patch getting confirmed /
merged so we can keep track of it.

Regards

Christian Dietrich

[0] http://vamos1.informatik.uni-erlangen.de/

Christian Dietrich (3):
drivers/scsi: Remove dead CONFIG_WD33C93_PIO
drivers/scsi/arcmsr: Remove dead CONFIG_SCSI_ARCMSR_RESET
drivers/scsi: Removing dead CONFIG_AIC7XXX_PROC_STATS

drivers/scsi/aic7xxx/aic7xxx_osm.c | 10 ----
drivers/scsi/arcmsr/arcmsr_hba.c | 80 ------------------------------------
drivers/scsi/wd33c93.c | 60 ---------------------------
drivers/scsi/wd33c93.h | 5 --
4 files changed, 0 insertions(+), 155 deletions(-)


2010-07-21 13:57:46

by Christian Dietrich

[permalink] [raw]
Subject: [PATCH 1/3] drivers/scsi: Remove dead CONFIG_WD33C93_PIO

CONFIG_WD33C93_PIO doesn't exist in Kconfig, therefore all existing
references to it from the source can be removed.

Signed-off-by: Christian Dietrich <[email protected]>
---
drivers/scsi/wd33c93.c | 60 ------------------------------------------------
drivers/scsi/wd33c93.h | 5 ----
2 files changed, 0 insertions(+), 65 deletions(-)

diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index b701bf2..f62efdf 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -171,65 +171,6 @@ module_param(setup_strings, charp, 0);

static void wd33c93_execute(struct Scsi_Host *instance);

-#ifdef CONFIG_WD33C93_PIO
-static inline uchar
-read_wd33c93(const wd33c93_regs regs, uchar reg_num)
-{
- uchar data;
-
- outb(reg_num, regs.SASR);
- data = inb(regs.SCMD);
- return data;
-}
-
-static inline unsigned long
-read_wd33c93_count(const wd33c93_regs regs)
-{
- unsigned long value;
-
- outb(WD_TRANSFER_COUNT_MSB, regs.SASR);
- value = inb(regs.SCMD) << 16;
- value |= inb(regs.SCMD) << 8;
- value |= inb(regs.SCMD);
- return value;
-}
-
-static inline uchar
-read_aux_stat(const wd33c93_regs regs)
-{
- return inb(regs.SASR);
-}
-
-static inline void
-write_wd33c93(const wd33c93_regs regs, uchar reg_num, uchar value)
-{
- outb(reg_num, regs.SASR);
- outb(value, regs.SCMD);
-}
-
-static inline void
-write_wd33c93_count(const wd33c93_regs regs, unsigned long value)
-{
- outb(WD_TRANSFER_COUNT_MSB, regs.SASR);
- outb((value >> 16) & 0xff, regs.SCMD);
- outb((value >> 8) & 0xff, regs.SCMD);
- outb( value & 0xff, regs.SCMD);
-}
-
-#define write_wd33c93_cmd(regs, cmd) \
- write_wd33c93((regs), WD_COMMAND, (cmd))
-
-static inline void
-write_wd33c93_cdb(const wd33c93_regs regs, uint len, uchar cmnd[])
-{
- int i;
-
- outb(WD_CDB_1, regs.SASR);
- for (i=0; i<len; i++)
- outb(cmnd[i], regs.SCMD);
-}
-
-#else /* CONFIG_WD33C93_PIO */
static inline uchar
read_wd33c93(const wd33c93_regs regs, uchar reg_num)
{
@@ -296,7 +237,6 @@ write_wd33c93_cdb(const wd33c93_regs regs, uint len, uchar cmnd[])
for (i = 0; i < len; i++)
*regs.SCMD = cmnd[i];
}
-#endif /* CONFIG_WD33C93_PIO */

static inline uchar
read_1_byte(const wd33c93_regs regs)
diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h
index 1ed5f3b..3a74fcd 100644
--- a/drivers/scsi/wd33c93.h
+++ b/drivers/scsi/wd33c93.h
@@ -190,13 +190,8 @@

/* This is what the 3393 chip looks like to us */
typedef struct {
-#ifdef CONFIG_WD33C93_PIO
- unsigned int SASR;
- unsigned int SCMD;
-#else
volatile unsigned char *SASR;
volatile unsigned char *SCMD;
-#endif
} wd33c93_regs;


--
1.7.0.4

2010-07-21 13:57:53

by Christian Dietrich

[permalink] [raw]
Subject: [PATCH 2/3] drivers/scsi/arcmsr: Remove dead CONFIG_SCSI_ARCMSR_RESET

CONFIG_SCSI_ARCMSR_RESET doesn't exist in Kconfig, therefore removing
all references to it from the source.

Signed-off-by: Christian Dietrich <[email protected]>
---
drivers/scsi/arcmsr/arcmsr_hba.c | 80 --------------------------------------
1 files changed, 0 insertions(+), 80 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index ffa5479..fb7866e 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -72,14 +72,6 @@
#include <scsi/scsicam.h>
#include "arcmsr.h"

-#ifdef CONFIG_SCSI_ARCMSR_RESET
- static int sleeptime = 20;
- static int retrycount = 12;
- module_param(sleeptime, int, S_IRUGO|S_IWUSR);
- MODULE_PARM_DESC(sleeptime, "The waiting period for FW ready while bus reset");
- module_param(retrycount, int, S_IRUGO|S_IWUSR);
- MODULE_PARM_DESC(retrycount, "The retry count for FW ready while bus reset");
-#endif
MODULE_AUTHOR("Erich Chen <[email protected]>");
MODULE_DESCRIPTION("ARECA (ARC11xx/12xx/13xx/16xx) SATA/SAS RAID Host Bus Adapter");
MODULE_LICENSE("Dual BSD/GPL");
@@ -2446,37 +2438,6 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb)
****************************************************************************
****************************************************************************
*/
-#ifdef CONFIG_SCSI_ARCMSR_RESET
- int arcmsr_sleep_for_bus_reset(struct scsi_cmnd *cmd)
- {
- struct Scsi_Host *shost = NULL;
- spinlock_t *host_lock = NULL;
- int i, isleep;
-
- shost = cmd->device->host;
- host_lock = shost->host_lock;
-
- printk(KERN_NOTICE "Host %d bus reset over, sleep %d seconds (busy %d, can queue %d) ...........\n",
- shost->host_no, sleeptime, shost->host_busy, shost->can_queue);
- isleep = sleeptime / 10;
- spin_unlock_irq(host_lock);
- if (isleep > 0) {
- for (i = 0; i < isleep; i++) {
- msleep(10000);
- printk(KERN_NOTICE "^%d^\n", i);
- }
- }
-
- isleep = sleeptime % 10;
- if (isleep > 0) {
- msleep(isleep * 1000);
- printk(KERN_NOTICE "^v^\n");
- }
- spin_lock_irq(host_lock);
- printk(KERN_NOTICE "***** wake up *****\n");
- return 0;
- }
-#endif
static void arcmsr_iop_init(struct AdapterControlBlock *acb)
{
uint32_t intmask_org;
@@ -2551,47 +2512,6 @@ static int arcmsr_bus_reset(struct scsi_cmnd *cmd)
arcmsr_hardware_reset(acb);
acb->acb_flags |= ACB_F_FIRMWARE_TRAP;
acb->acb_flags &= ~ACB_F_IOP_INITED;
- #ifdef CONFIG_SCSI_ARCMSR_RESET
- struct MessageUnit_A __iomem *reg = acb->pmuA;
- uint32_t intmask_org, outbound_doorbell;
- int retry_count = 0;
-sleep_again:
- arcmsr_sleep_for_bus_reset(cmd);
- if ((readl(&reg->outbound_msgaddr1) &
- ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0) {
- printk(KERN_NOTICE "arcmsr%d: hardware bus reset and return busy, retry=%d \n",
- acb->host->host_no, retry_count);
- if (retry_count > retrycount) {
- printk(KERN_NOTICE "arcmsr%d: hardware bus reset and return busy, retry aborted \n",
- acb->host->host_no);
- return SUCCESS;
- }
- retry_count++;
- goto sleep_again;
- }
- acb->acb_flags &= ~ACB_F_FIRMWARE_TRAP;
- acb->acb_flags |= ACB_F_IOP_INITED;
- acb->acb_flags &= ~ACB_F_BUS_RESET;
- printk(KERN_NOTICE "arcmsr%d: hardware bus reset and reset ok \n",
- acb->host->host_no);
- /* disable all outbound interrupt */
- intmask_org = arcmsr_disable_outbound_ints(acb);
- arcmsr_get_firmware_spec(acb, 1);
- /*start background rebuild*/
- arcmsr_start_adapter_bgrb(acb);
- /* clear Qbuffer if door bell ringed */
- outbound_doorbell = readl(&reg->outbound_doorbell);
- writel(outbound_doorbell, &reg->outbound_doorbell); /*clear interrupt */
- writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &reg->inbound_doorbell);
- /* enable outbound Post Queue,outbound doorbell Interrupt */
- arcmsr_enable_outbound_ints(acb, intmask_org);
- atomic_set(&acb->rq_map_token, 16);
- init_timer(&acb->eternal_timer);
- acb->eternal_timer.expires = jiffies + msecs_to_jiffies(20*HZ);
- acb->eternal_timer.data = (unsigned long) acb;
- acb->eternal_timer.function = &arcmsr_request_device_map;
- add_timer(&acb->eternal_timer);
- #endif
}
break;
case ACB_ADAPTER_TYPE_B: {
--
1.7.0.4

2010-07-21 19:35:01

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 1/3] drivers/scsi: Remove dead CONFIG_WD33C93_PIO

On Wed, Jul 21, 2010 at 15:57, Christian Dietrich
<[email protected]> wrote:
> CONFIG_WD33C93_PIO doesn't exist in Kconfig, therefore all existing
> references to it from the source can be removed.

I've just checked full-history-linux. It came from this commit:

Author: Osamu Tomita <[email protected]>
Date: Wed Mar 26 21:38:14 2003 -0600

[PATCH] Complete support for PC-9800 sub-arch (9/9) SCSI

This is the patch to support NEC PC-9800 subarchitecture
against 2.5.65-ac4. (9/9)

SCSI host adapter support.
- BIOS parameter change for PC98.
- Add pc980155 driver for old PC98.
- wd33c93.c update error handler for eh_*.
- wd33c93.h register to int for PIO mode.

But the driver was removed again about on year later:

commit 36f51e495878ff38d639fe3109a6cbaba6c4f2be
Author: Linus Torvalds <[email protected]>
Date: Thu Jun 17 19:33:53 2004 -0700

This removes the files orphaned by the earlier PC9800 removal

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds