Commit a2cf79d1 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-scsi.bkbits.net/scsi-for-linus-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 5d6893e6 384cce6d
...@@ -679,27 +679,26 @@ static int aac_cfg_ioctl(struct inode * inode, struct file * file, unsigned int ...@@ -679,27 +679,26 @@ static int aac_cfg_ioctl(struct inode * inode, struct file * file, unsigned int
*/ */
static Scsi_Host_Template driver_template = { static Scsi_Host_Template driver_template = {
module: THIS_MODULE, .module = THIS_MODULE,
name: "AAC", .name = "AAC",
proc_info: aac_procinfo, .proc_info = aac_procinfo,
detect: aac_detect, .detect = aac_detect,
release: aac_release, .release = aac_release,
info: aac_driverinfo, .info = aac_driverinfo,
ioctl: aac_ioctl, .ioctl = aac_ioctl,
queuecommand: aac_queuecommand, .queuecommand = aac_queuecommand,
bios_param: aac_biosparm, .bios_param = aac_biosparm,
slave_configure: aac_slave_configure, .slave_configure = aac_slave_configure,
can_queue: AAC_NUM_IO_FIB, .can_queue = AAC_NUM_IO_FIB,
this_id: 16, .this_id = 16,
sg_tablesize: 16, .sg_tablesize = 16,
max_sectors: 128, .max_sectors = 128,
cmd_per_lun: AAC_NUM_IO_FIB, .cmd_per_lun = 1,
eh_abort_handler: aac_eh_abort, .eh_abort_handler = aac_eh_abort,
eh_device_reset_handler:aac_eh_device_reset, .eh_device_reset_handler = aac_eh_device_reset,
eh_bus_reset_handler: aac_eh_bus_reset, .eh_bus_reset_handler = aac_eh_bus_reset,
eh_host_reset_handler: aac_eh_reset, .eh_host_reset_handler = aac_eh_reset,
.use_clustering = ENABLE_CLUSTERING,
use_clustering: ENABLE_CLUSTERING,
}; };
#include "scsi_module.c" #include "scsi_module.c"
......
...@@ -549,6 +549,7 @@ struct Scsi_Device_Template ...@@ -549,6 +549,7 @@ struct Scsi_Device_Template
void (*detach)(Scsi_Device *); void (*detach)(Scsi_Device *);
int (*init_command)(Scsi_Cmnd *); /* Used by new queueing code. int (*init_command)(Scsi_Cmnd *); /* Used by new queueing code.
Selects command for blkdevs */ Selects command for blkdevs */
void (*rescan)(Scsi_Device *);
struct device_driver scsi_driverfs_driver; struct device_driver scsi_driverfs_driver;
}; };
......
...@@ -606,7 +606,7 @@ static int osst_wait_ready(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned ...@@ -606,7 +606,7 @@ static int osst_wait_ready(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt; Scsi_Request * SRpnt;
long startwait = jiffies; unsigned long startwait = jiffies;
#if DEBUG #if DEBUG
int dbg = debugging; int dbg = debugging;
char * name = tape_name(STp); char * name = tape_name(STp);
...@@ -673,7 +673,7 @@ static int osst_wait_for_medium(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsi ...@@ -673,7 +673,7 @@ static int osst_wait_for_medium(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsi
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt; Scsi_Request * SRpnt;
long startwait = jiffies; unsigned long startwait = jiffies;
#if DEBUG #if DEBUG
int dbg = debugging; int dbg = debugging;
char * name = tape_name(STp); char * name = tape_name(STp);
...@@ -777,7 +777,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -777,7 +777,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
#define OSST_POLL_PER_SEC 10 #define OSST_POLL_PER_SEC 10
static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int to) static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int to)
{ {
long startwait = jiffies; unsigned long startwait = jiffies;
char * name = tape_name(STp); char * name = tape_name(STp);
#if DEBUG #if DEBUG
char notyetprinted = 1; char notyetprinted = 1;
...@@ -1288,7 +1288,7 @@ static int osst_read_back_buffer_and_rewrite(OS_Scsi_Tape * STp, Scsi_Request ** ...@@ -1288,7 +1288,7 @@ static int osst_read_back_buffer_and_rewrite(OS_Scsi_Tape * STp, Scsi_Request **
int logical_blk_num = ntohl(STp->buffer->aux->logical_blk_num) int logical_blk_num = ntohl(STp->buffer->aux->logical_blk_num)
- (nframes + pending - 1) * blks_per_frame; - (nframes + pending - 1) * blks_per_frame;
char * name = tape_name(STp); char * name = tape_name(STp);
long startwait = jiffies; unsigned long startwait = jiffies;
#if DEBUG #if DEBUG
int dbg = debugging; int dbg = debugging;
#endif #endif
...@@ -1477,7 +1477,7 @@ static int osst_reposition_and_retry(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, ...@@ -1477,7 +1477,7 @@ static int osst_reposition_and_retry(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
int expected = 0; int expected = 0;
int attempts = 1000 / skip; int attempts = 1000 / skip;
int flag = 1; int flag = 1;
long startwait = jiffies; unsigned long startwait = jiffies;
#if DEBUG #if DEBUG
int dbg = debugging; int dbg = debugging;
#endif #endif
......
...@@ -836,14 +836,22 @@ static int isp2x00_make_portdb(struct Scsi_Host *host) ...@@ -836,14 +836,22 @@ static int isp2x00_make_portdb(struct Scsi_Host *host)
short param[8]; short param[8];
int i, j; int i, j;
struct id_name_map temp[QLOGICFC_MAX_ID + 1]; struct id_name_map *map; /* base of array [QLOGICFC_MAX_ID + 1] */
struct id_name_map *mapx; /* array entry pointer */
struct isp2x00_hostdata *hostdata; struct isp2x00_hostdata *hostdata;
isp2x00_disable_irqs(host);
memset(temp, 0, sizeof(temp));
hostdata = (struct isp2x00_hostdata *) host->hostdata; hostdata = (struct isp2x00_hostdata *) host->hostdata;
map = kmalloc((QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map), GFP_ATOMIC);
if (!map) {
printk("qlogicfc%d : error getting memory -- cannot make port database.\n",
hostdata->host_id);
goto fini;
}
memset(map, 0, (QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map));
isp2x00_disable_irqs(host);
#if ISP2x00_FABRIC #if ISP2x00_FABRIC
for (i = 0x81; i < QLOGICFC_MAX_ID; i++) { for (i = 0x81; i < QLOGICFC_MAX_ID; i++) {
param[0] = MBOX_PORT_LOGOUT; param[0] = MBOX_PORT_LOGOUT;
...@@ -868,72 +876,74 @@ static int isp2x00_make_portdb(struct Scsi_Host *host) ...@@ -868,72 +876,74 @@ static int isp2x00_make_portdb(struct Scsi_Host *host)
if (param[0] == MBOX_COMMAND_COMPLETE) { if (param[0] == MBOX_COMMAND_COMPLETE) {
hostdata->port_id = ((u_int) param[3]) << 16; hostdata->port_id = ((u_int) param[3]) << 16;
hostdata->port_id |= param[2]; hostdata->port_id |= param[2];
temp[0].loop_id = param[1]; map->loop_id = param[1];
temp[0].wwn = hostdata->wwn; map->wwn = hostdata->wwn;
} }
else { else {
printk("qlogicfc%d : error getting scsi id.\n", hostdata->host_id); printk("qlogicfc%d : error getting scsi id.\n", hostdata->host_id);
} }
for (i = 0; i <=QLOGICFC_MAX_ID; i++) for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++)
temp[i].loop_id = temp[0].loop_id; mapx->loop_id = map->loop_id;
for (i = 0, j = 1; i <= QLOGICFC_MAX_LOOP_ID; i++) { for (i = 0, j = 1, mapx = map + 1; i <= QLOGICFC_MAX_LOOP_ID; i++) {
param[0] = MBOX_GET_PORT_NAME; param[0] = MBOX_GET_PORT_NAME;
param[1] = (i << 8) & 0xff00; param[1] = (i << 8) & 0xff00;
isp2x00_mbox_command(host, param); isp2x00_mbox_command(host, param);
if (param[0] == MBOX_COMMAND_COMPLETE) { if (param[0] == MBOX_COMMAND_COMPLETE) {
temp[j].loop_id = i; mapx->loop_id = i;
temp[j].wwn = ((u64) (param[2] & 0xff)) << 56; mapx->wwn = ((u64) (param[2] & 0xff)) << 56;
temp[j].wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48; mapx->wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48;
temp[j].wwn |= ((u64) (param[3] & 0xff)) << 40; mapx->wwn |= ((u64) (param[3] & 0xff)) << 40;
temp[j].wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32; mapx->wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32;
temp[j].wwn |= ((u64) (param[6] & 0xff)) << 24; mapx->wwn |= ((u64) (param[6] & 0xff)) << 24;
temp[j].wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16; mapx->wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16;
temp[j].wwn |= ((u64) (param[7] & 0xff)) << 8; mapx->wwn |= ((u64) (param[7] & 0xff)) << 8;
temp[j].wwn |= ((u64) ((param[7] >> 8) & 0xff)); mapx->wwn |= ((u64) ((param[7] >> 8) & 0xff));
j++; j++;
mapx++;
} }
} }
#if ISP2x00_FABRIC #if ISP2x00_FABRIC
isp2x00_init_fabric(host, temp, j); isp2x00_init_fabric(host, map, j);
#endif #endif
for (i = 0; i <= QLOGICFC_MAX_ID; i++) { for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++) {
if (temp[i].wwn != hostdata->port_db[i].wwn) { struct id_name_map *tmap; /* second array entry pointer */
for (j = 0; j <= QLOGICFC_MAX_ID; j++) { if (mapx->wwn != hostdata->port_db[i].wwn) {
if (temp[j].wwn == hostdata->port_db[i].wwn) { for (j = 0, tmap = map; j <= QLOGICFC_MAX_ID; j++, tmap++) {
hostdata->port_db[i].loop_id = temp[j].loop_id; if (tmap->wwn == hostdata->port_db[i].wwn) {
hostdata->port_db[i].loop_id = tmap->loop_id;
break; break;
} }
} }
if (j == QLOGICFC_MAX_ID + 1) if (j == QLOGICFC_MAX_ID + 1)
hostdata->port_db[i].loop_id = temp[0].loop_id; hostdata->port_db[i].loop_id = map->loop_id;
for (j = 0; j <= QLOGICFC_MAX_ID; j++) { for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
if (hostdata->port_db[j].wwn == temp[i].wwn || !hostdata->port_db[j].wwn) { if (hostdata->port_db[j].wwn == mapx->wwn || !hostdata->port_db[j].wwn) {
break; break;
} }
} }
if (j == QLOGICFC_MAX_ID + 1) if (j == QLOGICFC_MAX_ID + 1)
printk("qlogicfc%d : Too many scsi devices, no more room in port map.\n", hostdata->host_id); printk("qlogicfc%d : Too many scsi devices, no more room in port map.\n", hostdata->host_id);
if (!hostdata->port_db[j].wwn) { if (!hostdata->port_db[j].wwn) {
hostdata->port_db[j].loop_id = temp[i].loop_id; hostdata->port_db[j].loop_id = mapx->loop_id;
hostdata->port_db[j].wwn = temp[i].wwn; hostdata->port_db[j].wwn = mapx->wwn;
} }
} else } else
hostdata->port_db[i].loop_id = temp[i].loop_id; hostdata->port_db[i].loop_id = mapx->loop_id;
} }
isp2x00_enable_irqs(host); isp2x00_enable_irqs(host);
kfree(map);
fini:
return 0; return 0;
} }
......
...@@ -96,12 +96,7 @@ unsigned long scsi_pid; ...@@ -96,12 +96,7 @@ unsigned long scsi_pid;
Scsi_Cmnd *last_cmnd; Scsi_Cmnd *last_cmnd;
static unsigned long serial_number; static unsigned long serial_number;
struct softscsi_data { static struct list_head done_q[NR_CPUS] __cacheline_aligned;
Scsi_Cmnd *head;
Scsi_Cmnd *tail;
};
static struct softscsi_data softscsi_data[NR_CPUS] __cacheline_aligned;
/* /*
* List of all highlevel drivers. * List of all highlevel drivers.
...@@ -637,79 +632,60 @@ void scsi_init_cmd_from_req(Scsi_Cmnd * SCpnt, Scsi_Request * SRpnt) ...@@ -637,79 +632,60 @@ void scsi_init_cmd_from_req(Scsi_Cmnd * SCpnt, Scsi_Request * SRpnt)
} }
/** /**
* scsi_done - Mark this command as done * scsi_done - Enqueue the finished SCSI command into the done queue.
* @SCpnt: The SCSI Command which we think we've completed. * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
* * ownership back to SCSI Core -- i.e. the LLDD has finished with it.
* This function is the mid-level interrupt routine, which decides how
* to handle error conditions. Each invocation of this function must
* do one and *only* one of the following:
* *
* 1) Insert command in BH queue. * This function is the mid-level's (SCSI Core) interrupt routine, which
* 2) Activate error handler for host. * regains ownership of the SCSI command (de facto) from a LLDD, and enqueues
* the command to the done queue for further processing.
* *
* There is no longer a problem with stack overflow. Interrupts queue * This is the producer of the done queue who enqueues at the tail.
* Scsi_Cmnd on a per-CPU queue and the softirq handler removes them
* from the queue one at a time.
* *
* This function is sometimes called from interrupt context, but sometimes * This function is interrupt context safe.
* from task context.
*/ */
void scsi_done(Scsi_Cmnd * SCpnt) void scsi_done(struct scsi_cmnd *cmd)
{ {
int cpu;
unsigned long flags; unsigned long flags;
int cpu, tstatus; struct list_head *pdone_q;
struct softscsi_data *queue;
/* /*
* We don't have to worry about this one timing out any more. * We don't have to worry about this one timing out any more.
*/ * If we are unable to remove the timer, then the command
tstatus = scsi_delete_timer(SCpnt); * has already timed out. In which case, we have no choice but to
/*
* If we are unable to remove the timer, it means that the command
* has already timed out. In this case, we have no choice but to
* let the timeout function run, as we have no idea where in fact * let the timeout function run, as we have no idea where in fact
* that function could really be. It might be on another processor, * that function could really be. It might be on another processor,
* etc, etc. * etc, etc.
*/ */
if (!tstatus) { if (!scsi_delete_timer(cmd))
return; return;
}
/* Set the serial numbers back to zero */ /* Set the serial numbers back to zero */
SCpnt->serial_number = 0; cmd->serial_number = 0;
SCpnt->serial_number_at_timeout = 0; cmd->serial_number_at_timeout = 0;
SCpnt->state = SCSI_STATE_BHQUEUE; cmd->state = SCSI_STATE_BHQUEUE;
SCpnt->owner = SCSI_OWNER_BH_HANDLER; cmd->owner = SCSI_OWNER_BH_HANDLER;
SCpnt->bh_next = NULL;
/* /*
* Next, put this command in the softirq queue. * Next, enqueue the command into the done queue.
* * It is a per-CPU queue, so we just disable local interrupts
* This is a per-CPU queue, so we just disable local interrupts
* and need no spinlock. * and need no spinlock.
*/ */
local_irq_save(flags); local_irq_save(flags);
cpu = smp_processor_id(); cpu = smp_processor_id();
queue = &softscsi_data[cpu]; pdone_q = &done_q[cpu];
list_add_tail(&cmd->eh_entry, pdone_q);
if (!queue->head) {
queue->head = SCpnt;
queue->tail = SCpnt;
} else {
queue->tail->bh_next = SCpnt;
queue->tail = SCpnt;
}
cpu_raise_softirq(cpu, SCSI_SOFTIRQ); cpu_raise_softirq(cpu, SCSI_SOFTIRQ);
local_irq_restore(flags); local_irq_restore(flags);
} }
/** /**
* scsi_softirq - Perform post-interrupt handling for completed commands * scsi_softirq - Perform post-interrupt processing of finished SCSI commands.
*
* This is the consumer of the done queue.
* *
* This is called with all interrupts enabled. This should reduce * This is called with all interrupts enabled. This should reduce
* interrupt latency, stack depth, and reentrancy of the low-level * interrupt latency, stack depth, and reentrancy of the low-level
...@@ -717,30 +693,30 @@ void scsi_done(Scsi_Cmnd * SCpnt) ...@@ -717,30 +693,30 @@ void scsi_done(Scsi_Cmnd * SCpnt)
*/ */
static void scsi_softirq(struct softirq_action *h) static void scsi_softirq(struct softirq_action *h)
{ {
int cpu = smp_processor_id(); LIST_HEAD(local_q);
struct softscsi_data *queue = &softscsi_data[cpu];
while (queue->head) {
Scsi_Cmnd *SCpnt, *SCnext;
local_irq_disable(); local_irq_disable();
SCpnt = queue->head; list_splice_init(&done_q[smp_processor_id()], &local_q);
queue->head = NULL;
local_irq_enable(); local_irq_enable();
for (; SCpnt; SCpnt = SCnext) { while (!list_empty(&local_q)) {
SCnext = SCpnt->bh_next; struct scsi_cmnd *cmd = list_entry(local_q.next,
struct scsi_cmnd, eh_entry);
list_del_init(&cmd->eh_entry);
switch (scsi_decide_disposition(SCpnt)) { switch (scsi_decide_disposition(cmd)) {
case SUCCESS: case SUCCESS:
/* /*
* Add to BH queue. * Add to BH queue.
*/ */
SCSI_LOG_MLCOMPLETE(3, printk("Command finished %d %d 0x%x\n", SCpnt->device->host->host_busy, SCSI_LOG_MLCOMPLETE(3,
SCpnt->device->host->host_failed, printk("Command finished %d %d "
SCpnt->result)); "0x%x\n",
cmd->device->host->host_busy,
cmd->device->host->host_failed,
cmd->result));
scsi_finish_command(SCpnt); scsi_finish_command(cmd);
break; break;
case NEEDS_RETRY: case NEEDS_RETRY:
/* /*
...@@ -750,10 +726,13 @@ static void scsi_softirq(struct softirq_action *h) ...@@ -750,10 +726,13 @@ static void scsi_softirq(struct softirq_action *h)
* track of the number of tries, so we don't * track of the number of tries, so we don't
* end up looping, of course. * end up looping, of course.
*/ */
SCSI_LOG_MLCOMPLETE(3, printk("Command needs retry %d %d 0x%x\n", SCpnt->device->host->host_busy, SCSI_LOG_MLCOMPLETE(3, printk("Command needs retry "
SCpnt->device->host->host_failed, SCpnt->result)); "%d %d 0x%x\n",
cmd->device->host->host_busy,
cmd->device->host->host_failed,
cmd->result));
scsi_retry_command(SCpnt); scsi_retry_command(cmd);
break; break;
case ADD_TO_MLQUEUE: case ADD_TO_MLQUEUE:
/* /*
...@@ -766,9 +745,11 @@ static void scsi_softirq(struct softirq_action *h) ...@@ -766,9 +745,11 @@ static void scsi_softirq(struct softirq_action *h)
* shouldn't end up with tons of things being * shouldn't end up with tons of things being
* sent down that shouldn't be. * sent down that shouldn't be.
*/ */
SCSI_LOG_MLCOMPLETE(3, printk("Command rejected as device queue full, put on ml queue %p\n", SCSI_LOG_MLCOMPLETE(3, printk("Command rejected as "
SCpnt)); "device queue full, "
scsi_queue_insert(SCpnt, SCSI_MLQUEUE_DEVICE_BUSY); "put on ml queue %p\n",
cmd));
scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY);
break; break;
default: default:
/* /*
...@@ -776,29 +757,28 @@ static void scsi_softirq(struct softirq_action *h) ...@@ -776,29 +757,28 @@ static void scsi_softirq(struct softirq_action *h)
* Turn it over to the error handler. * Turn it over to the error handler.
*/ */
SCSI_LOG_MLCOMPLETE(3, SCSI_LOG_MLCOMPLETE(3,
printk("Command failed %p %x busy=%d failed=%d\n", printk("Command failed %p %x "
SCpnt, SCpnt->result, "busy=%d failed=%d\n",
SCpnt->device->host->host_busy, cmd, cmd->result,
SCpnt->device->host->host_failed)); cmd->device->host->host_busy,
cmd->device->host->host_failed));
/* /*
* Dump the sense information too. * Dump the sense information too.
*/ */
if ((status_byte(SCpnt->result) & CHECK_CONDITION) != 0) { if ((status_byte(cmd->result)&CHECK_CONDITION) != 0) {
SCSI_LOG_MLCOMPLETE(3, print_sense("bh", SCpnt)); SCSI_LOG_MLCOMPLETE(3, print_sense("bh", cmd));
} }
if (!scsi_eh_scmd_add(SCpnt, 0)) if (!scsi_eh_scmd_add(cmd, 0)) {
{
/* /*
* We only get here if the error * We only get here if the error
* recovery thread has died. * recovery thread has died.
*/ */
scsi_finish_command(SCpnt); scsi_finish_command(cmd);
}
}
} }
} /* switch */
} /* for(; SCpnt...) */
} /* while(queue->head) */
} }
/* /*
...@@ -1284,6 +1264,21 @@ void scsi_detach_device(struct scsi_device *sdev) ...@@ -1284,6 +1264,21 @@ void scsi_detach_device(struct scsi_device *sdev)
up_read(&scsi_devicelist_mutex); up_read(&scsi_devicelist_mutex);
} }
void scsi_rescan_device(struct scsi_device *sdev)
{
struct Scsi_Device_Template *sdt;
down_read(&scsi_devicelist_mutex);
list_for_each_entry(sdt, &scsi_devicelist, list) {
if (!try_module_get(sdt->module))
continue;
if (*sdt->rescan)
(*sdt->rescan)(sdev);
module_put(sdt->module);
}
up_read(&scsi_devicelist_mutex);
}
int scsi_device_get(struct scsi_device *sdev) int scsi_device_get(struct scsi_device *sdev)
{ {
if (!try_module_get(sdev->host->hostt->module)) if (!try_module_get(sdev->host->hostt->module))
...@@ -1481,7 +1476,7 @@ __setup("scsi_default_dev_flags=", setup_scsi_default_dev_flags); ...@@ -1481,7 +1476,7 @@ __setup("scsi_default_dev_flags=", setup_scsi_default_dev_flags);
static int __init init_scsi(void) static int __init init_scsi(void)
{ {
int error; int error, i;
error = scsi_init_queue(); error = scsi_init_queue();
if (error) if (error)
...@@ -1496,6 +1491,9 @@ static int __init init_scsi(void) ...@@ -1496,6 +1491,9 @@ static int __init init_scsi(void)
if (error) if (error)
goto cleanup_devlist; goto cleanup_devlist;
for (i = 0; i < NR_CPUS; i++)
INIT_LIST_HEAD(&done_q[i]);
scsi_host_init(); scsi_host_init();
devfs_mk_dir(NULL, "scsi", NULL); devfs_mk_dir(NULL, "scsi", NULL);
open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL); open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL);
......
...@@ -741,8 +741,7 @@ struct scsi_cmnd { ...@@ -741,8 +741,7 @@ struct scsi_cmnd {
* abort, etc are in process. * abort, etc are in process.
*/ */
unsigned volatile char internal_timeout; unsigned volatile char internal_timeout;
struct scsi_cmnd *bh_next; /* To enumerate the commands waiting
to be processed. */
unsigned char cmd_len; unsigned char cmd_len;
unsigned char old_cmd_len; unsigned char old_cmd_len;
unsigned char sc_data_direction; unsigned char sc_data_direction;
......
This diff is collapsed.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <linux/types.h> #include <linux/types.h>
static int scsi_debug_slave_alloc(struct scsi_device *);
static int scsi_debug_slave_configure(struct scsi_device *); static int scsi_debug_slave_configure(struct scsi_device *);
static void scsi_debug_slave_destroy(struct scsi_device *); static void scsi_debug_slave_destroy(struct scsi_device *);
static int scsi_debug_queuecommand(struct scsi_cmnd *, static int scsi_debug_queuecommand(struct scsi_cmnd *,
...@@ -27,6 +28,7 @@ static Scsi_Host_Template sdebug_driver_template = { ...@@ -27,6 +28,7 @@ static Scsi_Host_Template sdebug_driver_template = {
.proc_info = scsi_debug_proc_info, .proc_info = scsi_debug_proc_info,
.name = "SCSI DEBUG", .name = "SCSI DEBUG",
.info = scsi_debug_info, .info = scsi_debug_info,
.slave_alloc = scsi_debug_slave_alloc,
.slave_configure = scsi_debug_slave_configure, .slave_configure = scsi_debug_slave_configure,
.slave_destroy = scsi_debug_slave_destroy, .slave_destroy = scsi_debug_slave_destroy,
.ioctl = scsi_debug_ioctl, .ioctl = scsi_debug_ioctl,
......
...@@ -596,28 +596,6 @@ static int scsi_request_sense(struct scsi_cmnd *scmd) ...@@ -596,28 +596,6 @@ static int scsi_request_sense(struct scsi_cmnd *scmd)
return rtn; return rtn;
} }
/**
* scsi_eh_retry_cmd - Retry the original command
* @scmd: Original failed SCSI cmd.
*
* Notes:
* This function will *not* return until the command either times out,
* or it completes.
**/
static int scsi_eh_retry_cmd(struct scsi_cmnd *scmd)
{
int rtn = SUCCESS;
for (; scmd->retries < scmd->allowed; scmd->retries++) {
scsi_setup_cmd_retry(scmd);
rtn = scsi_send_eh_cmnd(scmd, scmd->timeout_per_command);
if (rtn != NEEDS_RETRY)
break;
}
return rtn;
}
/** /**
* scsi_eh_finish_cmd - Handle a cmd that eh is finished with. * scsi_eh_finish_cmd - Handle a cmd that eh is finished with.
* @scmd: Original SCSI cmd that eh has finished. * @scmd: Original SCSI cmd that eh has finished.
......
...@@ -125,7 +125,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) ...@@ -125,7 +125,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
*/ */
cmd->state = SCSI_STATE_MLQUEUE; cmd->state = SCSI_STATE_MLQUEUE;
cmd->owner = SCSI_OWNER_MIDLEVEL; cmd->owner = SCSI_OWNER_MIDLEVEL;
cmd->bh_next = NULL;
/* /*
* Decrement the counters, since these commands are no longer * Decrement the counters, since these commands are no longer
......
...@@ -385,8 +385,10 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, ...@@ -385,8 +385,10 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
struct scsi_device *sdev, *device; struct scsi_device *sdev, *device;
sdev = kmalloc(sizeof(*sdev), GFP_ATOMIC); sdev = kmalloc(sizeof(*sdev), GFP_ATOMIC);
if (sdev != NULL) { if (!sdev)
memset(sdev, 0, sizeof(Scsi_Device)); goto out;
memset(sdev, 0, sizeof(*sdev));
sdev->vendor = scsi_null_device_strs; sdev->vendor = scsi_null_device_strs;
sdev->model = scsi_null_device_strs; sdev->model = scsi_null_device_strs;
sdev->rev = scsi_null_device_strs; sdev->rev = scsi_null_device_strs;
...@@ -399,10 +401,12 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, ...@@ -399,10 +401,12 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
INIT_LIST_HEAD(&sdev->same_target_siblings); INIT_LIST_HEAD(&sdev->same_target_siblings);
INIT_LIST_HEAD(&sdev->cmd_list); INIT_LIST_HEAD(&sdev->cmd_list);
spin_lock_init(&sdev->list_lock); spin_lock_init(&sdev->list_lock);
/* /*
* Some low level driver could use device->type * Some low level driver could use device->type
*/ */
sdev->type = -1; sdev->type = -1;
/* /*
* Assume that the device will have handshaking problems, * Assume that the device will have handshaking problems,
* and then fix this field later if it turns out it * and then fix this field later if it turns out it
...@@ -413,7 +417,7 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, ...@@ -413,7 +417,7 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
if (!q || *q == NULL) { if (!q || *q == NULL) {
sdev->request_queue = scsi_alloc_queue(shost); sdev->request_queue = scsi_alloc_queue(shost);
if (!sdev->request_queue) if (!sdev->request_queue)
goto out_bail; goto out_free_dev;
} else { } else {
sdev->request_queue = *q; sdev->request_queue = *q;
*q = NULL; *q = NULL;
...@@ -423,16 +427,17 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, ...@@ -423,16 +427,17 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
init_waitqueue_head(&sdev->scpnt_wait); init_waitqueue_head(&sdev->scpnt_wait);
if (shost->hostt->slave_alloc) if (shost->hostt->slave_alloc) {
if (shost->hostt->slave_alloc(sdev)) { if (shost->hostt->slave_alloc(sdev))
goto out_bail; goto out_free_queue;
} }
/* /*
* If there are any same target siblings, add this to the * If there are any same target siblings, add this to the
* sibling list * sibling list
*/ */
list_for_each_entry(device, &shost->my_devices, siblings) { list_for_each_entry(device, &shost->my_devices, siblings) {
if(device->id == sdev->id && if (device->id == sdev->id &&
device->channel == sdev->channel) { device->channel == sdev->channel) {
list_add_tail(&sdev->same_target_siblings, list_add_tail(&sdev->same_target_siblings,
&device->same_target_siblings); &device->same_target_siblings);
...@@ -440,28 +445,32 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, ...@@ -440,28 +445,32 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
break; break;
} }
} }
/* /*
* If there wasn't another lun already configured at this * If there wasn't another lun already configured at this
* target, then default this device to SCSI_2 until we * target, then default this device to SCSI_2 until we
* know better * know better
*/ */
if(!sdev->scsi_level) if (!sdev->scsi_level)
sdev->scsi_level = SCSI_2; sdev->scsi_level = SCSI_2;
/* /*
* Add it to the end of the shost->my_devices list. * Add it to the end of the shost->my_devices list.
*/ */
list_add_tail(&sdev->siblings, &shost->my_devices); list_add_tail(&sdev->siblings, &shost->my_devices);
return (sdev); return sdev;
}
out_bail: out_free_queue:
printk(ALLOC_FAILURE_MSG, __FUNCTION__);
if (q && sdev->request_queue) { if (q && sdev->request_queue) {
*q = sdev->request_queue; *q = sdev->request_queue;
sdev->request_queue = NULL; sdev->request_queue = NULL;
} else if (sdev->request_queue) } else if (sdev->request_queue)
scsi_free_queue(sdev->request_queue); scsi_free_queue(sdev->request_queue);
out_free_dev:
kfree(sdev); kfree(sdev);
out:
printk(ALLOC_FAILURE_MSG, __FUNCTION__);
return NULL; return NULL;
} }
......
...@@ -266,6 +266,25 @@ sdev_rd_attr (model, "%.16s\n"); ...@@ -266,6 +266,25 @@ sdev_rd_attr (model, "%.16s\n");
sdev_rd_attr (rev, "%.4s\n"); sdev_rd_attr (rev, "%.4s\n");
sdev_rw_attr_bit (online); sdev_rw_attr_bit (online);
static ssize_t
show_rescan_field (struct device *dev, char *buf)
{
return 0;
}
static ssize_t
store_rescan_field (struct device *dev, const char *buf, size_t count)
{
int ret = ENODEV;
struct scsi_device *sdev;
sdev = to_scsi_device(dev);
if (sdev)
ret = scsi_rescan_device(sdev);
return ret;
}
static DEVICE_ATTR(rescan, S_IRUGO | S_IWUSR, show_rescan_field, store_rescan_field)
static struct device_attribute * const sdev_attrs[] = { static struct device_attribute * const sdev_attrs[] = {
&dev_attr_device_blocked, &dev_attr_device_blocked,
&dev_attr_queue_depth, &dev_attr_queue_depth,
...@@ -276,6 +295,7 @@ static struct device_attribute * const sdev_attrs[] = { ...@@ -276,6 +295,7 @@ static struct device_attribute * const sdev_attrs[] = {
&dev_attr_model, &dev_attr_model,
&dev_attr_rev, &dev_attr_rev,
&dev_attr_online, &dev_attr_online,
&dev_attr_rescan,
}; };
/** /**
......
...@@ -93,10 +93,12 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt); ...@@ -93,10 +93,12 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt);
static int sd_attach(struct scsi_device *); static int sd_attach(struct scsi_device *);
static void sd_detach(struct scsi_device *); static void sd_detach(struct scsi_device *);
static void sd_rescan(struct scsi_device *);
static int sd_init_command(struct scsi_cmnd *); static int sd_init_command(struct scsi_cmnd *);
static int sd_synchronize_cache(struct scsi_disk *, int); static int sd_synchronize_cache(struct scsi_disk *, int);
static int sd_notifier(struct notifier_block *, unsigned long, void *); static int sd_notifier(struct notifier_block *, unsigned long, void *);
static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
struct scsi_request *SRpnt, unsigned char *buffer);
static struct notifier_block sd_notifier_block = {sd_notifier, NULL, 0}; static struct notifier_block sd_notifier_block = {sd_notifier, NULL, 0};
static struct Scsi_Device_Template sd_template = { static struct Scsi_Device_Template sd_template = {
...@@ -106,6 +108,7 @@ static struct Scsi_Device_Template sd_template = { ...@@ -106,6 +108,7 @@ static struct Scsi_Device_Template sd_template = {
.scsi_type = TYPE_DISK, .scsi_type = TYPE_DISK,
.attach = sd_attach, .attach = sd_attach,
.detach = sd_detach, .detach = sd_detach,
.rescan = sd_rescan,
.init_command = sd_init_command, .init_command = sd_init_command,
.scsi_driverfs_driver = { .scsi_driverfs_driver = {
.name = "sd", .name = "sd",
...@@ -629,6 +632,38 @@ static int sd_media_changed(struct gendisk *disk) ...@@ -629,6 +632,38 @@ static int sd_media_changed(struct gendisk *disk)
return 1; return 1;
} }
static void sd_rescan(struct scsi_device * sdp)
{
unsigned char *buffer;
struct scsi_disk *sdkp = sd_find_by_sdev(sdp);
struct gendisk *gd;
struct scsi_request *SRpnt;
if (!sdkp || sdp->online == FALSE || !sdkp->media_present)
return;
gd = sdkp->disk;
SCSI_LOG_HLQUEUE(3, printk("sd_rescan: disk=%s\n", gd->disk_name));
SRpnt = scsi_allocate_request(sdp);
if (!SRpnt) {
printk(KERN_WARNING "(sd_rescan:) Request allocation "
"failure.\n");
return;
}
if (sdkp->device->host->unchecked_isa_dma)
buffer = kmalloc(512, GFP_DMA);
else
buffer = kmalloc(512, GFP_KERNEL);
sd_read_capacity(sdkp, gd->disk_name, SRpnt, buffer);
set_capacity(gd, sdkp->capacity);
scsi_release_request(SRpnt);
kfree(buffer);
}
static int sd_revalidate_disk(struct gendisk *disk) static int sd_revalidate_disk(struct gendisk *disk)
{ {
struct scsi_disk *sdkp = scsi_disk(disk); struct scsi_disk *sdkp = scsi_disk(disk);
......
...@@ -18,10 +18,8 @@ ...@@ -18,10 +18,8 @@
* *
*/ */
#include <linux/config.h> #include <linux/config.h>
#ifdef CONFIG_PROC_FS static char *sg_version_str = "3.5.28 [20030308]";
static char *sg_version_str = "Version: 3.5.27 (20030130)"; static int sg_version_num = 30528; /* 2 digits for each component */
#endif
static int sg_version_num = 30527; /* 2 digits for each component */
/* /*
* D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes: * D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
* - scsi logging is available via SCSI_LOG_TIMEOUT macros. First * - scsi logging is available via SCSI_LOG_TIMEOUT macros. First
...@@ -56,6 +54,7 @@ static int sg_version_num = 30527; /* 2 digits for each component */ ...@@ -56,6 +54,7 @@ static int sg_version_num = 30527; /* 2 digits for each component */
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/moduleparam.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -1327,27 +1326,6 @@ static struct file_operations sg_fops = { ...@@ -1327,27 +1326,6 @@ static struct file_operations sg_fops = {
.fasync = sg_fasync, .fasync = sg_fasync,
}; };
#ifndef MODULE
static int __init
sg_def_reserved_size_setup(char *str)
{
int tmp;
if (get_option(&str, &tmp) == 1) {
def_reserved_size = tmp;
if (tmp >= 0)
sg_big_buff = tmp;
return 1;
} else {
printk(KERN_WARNING "sg_def_reserved_size : usage "
"sg_def_reserved_size=n (n could be 65536, 131072 or 262144)\n");
return 0;
}
}
__setup("sg_def_reserved_size=", sg_def_reserved_size_setup);
#endif
/* Driverfs file support */ /* Driverfs file support */
static ssize_t static ssize_t
sg_device_kdev_read(struct device *driverfs_dev, char *page) sg_device_kdev_read(struct device *driverfs_dev, char *page)
...@@ -1564,16 +1542,77 @@ sg_detach(Scsi_Device * scsidp) ...@@ -1564,16 +1542,77 @@ sg_detach(Scsi_Device * scsidp)
scsi_sleep(2); /* dirty detach so delay device destruction */ scsi_sleep(2); /* dirty detach so delay device destruction */
} }
/* Set 'perm' (4th argument) to 0 to disable module_param's definition
* of sysfs parameters (which module_param doesn't yet support).
* Sysfs parameters defined explicitly below.
*/
module_param_named(def_reserved_size, def_reserved_size, int, 0);
module_param_named(allow_dio, sg_allow_dio, int, 0);
MODULE_AUTHOR("Douglas Gilbert"); MODULE_AUTHOR("Douglas Gilbert");
MODULE_DESCRIPTION("SCSI generic (sg) driver"); MODULE_DESCRIPTION("SCSI generic (sg) driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#endif
MODULE_PARM(def_reserved_size, "i");
MODULE_PARM_DESC(def_reserved_size, "size of buffer reserved for each fd"); MODULE_PARM_DESC(def_reserved_size, "size of buffer reserved for each fd");
static ssize_t sg_allow_dio_show(struct device_driver * ddp, char * buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", sg_allow_dio);
}
static ssize_t sg_allow_dio_store(struct device_driver * ddp,
const char * buf, size_t count)
{
if (1 == sscanf(buf, "%d", &sg_allow_dio)) {
sg_allow_dio = sg_allow_dio ? 1 : 0;
return count;
}
return -EINVAL;
}
DRIVER_ATTR(allow_dio, S_IRUGO | S_IWUSR, sg_allow_dio_show,
sg_allow_dio_store)
static ssize_t sg_def_reserved_show(struct device_driver * ddp, char * buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", sg_big_buff);
}
static ssize_t sg_def_reserved_store(struct device_driver * ddp,
const char * buf, size_t count)
{
if (1 == sscanf(buf, "%d", &def_reserved_size)) {
if (def_reserved_size >= 0) {
sg_big_buff = def_reserved_size;
return count;
}
}
return -EINVAL;
}
DRIVER_ATTR(def_reserved_size, S_IRUGO | S_IWUSR, sg_def_reserved_show,
sg_def_reserved_store)
static ssize_t sg_version_show(struct device_driver * ddp, char * buf)
{
return snprintf(buf, PAGE_SIZE, "%s\n", sg_version_str);
}
DRIVER_ATTR(version, S_IRUGO, sg_version_show, NULL)
static void do_create_driverfs_files(void)
{
struct device_driver * driverfs = &sg_template.scsi_driverfs_driver;
driver_create_file(driverfs, &driver_attr_allow_dio);
driver_create_file(driverfs, &driver_attr_def_reserved_size);
driver_create_file(driverfs, &driver_attr_version);
}
static void do_remove_driverfs_files(void)
{
struct device_driver * driverfs = &sg_template.scsi_driverfs_driver;
driver_remove_file(driverfs, &driver_attr_version);
driver_remove_file(driverfs, &driver_attr_def_reserved_size);
driver_remove_file(driverfs, &driver_attr_allow_dio);
}
static int __init static int __init
init_sg(void) init_sg(void)
{ {
...@@ -1591,12 +1630,14 @@ init_sg(void) ...@@ -1591,12 +1630,14 @@ init_sg(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
sg_proc_init(); sg_proc_init();
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
do_create_driverfs_files();
return 0; return 0;
} }
static void __exit static void __exit
exit_sg(void) exit_sg(void)
{ {
do_remove_driverfs_files();
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
sg_proc_cleanup(); sg_proc_cleanup();
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
...@@ -2656,10 +2697,6 @@ sg_get_dev(int dev) ...@@ -2656,10 +2697,6 @@ sg_get_dev(int dev)
static struct proc_dir_entry *sg_proc_sgp = NULL; static struct proc_dir_entry *sg_proc_sgp = NULL;
static char sg_proc_sg_dirname[] = "sg"; static char sg_proc_sg_dirname[] = "sg";
static const char *sg_proc_leaf_names[] = { "allow_dio", "def_reserved_size",
"debug", "devices", "device_hdr", "device_strs",
"hosts", "host_hdr", "host_strs", "version"
};
static int sg_proc_adio_read(char *buffer, char **start, off_t offset, static int sg_proc_adio_read(char *buffer, char **start, off_t offset,
int size, int *eof, void *data); int size, int *eof, void *data);
...@@ -2693,13 +2730,21 @@ static int sg_proc_version_read(char *buffer, char **start, off_t offset, ...@@ -2693,13 +2730,21 @@ static int sg_proc_version_read(char *buffer, char **start, off_t offset,
int size, int *eof, void *data); int size, int *eof, void *data);
static int sg_proc_version_info(char *buffer, int *len, off_t * begin, static int sg_proc_version_info(char *buffer, int *len, off_t * begin,
off_t offset, int size); off_t offset, int size);
static read_proc_t *sg_proc_leaf_reads[] = {
sg_proc_adio_read, sg_proc_dressz_read, sg_proc_debug_read, struct sg_proc_leaf {
sg_proc_dev_read, sg_proc_devhdr_read, sg_proc_devstrs_read, const char * name;
sg_proc_version_read read_proc_t * rf;
write_proc_t * wf;
}; };
static write_proc_t *sg_proc_leaf_writes[] = {
sg_proc_adio_write, sg_proc_dressz_write, 0, 0, 0, 0, 0, 0, 0, 0 static struct sg_proc_leaf sg_proc_leaf_arr[] = {
{"allow_dio", sg_proc_adio_read, sg_proc_adio_write},
{"def_reserved_size", sg_proc_dressz_read, sg_proc_dressz_write},
{"debug", sg_proc_debug_read, NULL},
{"devices", sg_proc_dev_read, NULL},
{"device_hdr", sg_proc_devhdr_read, NULL},
{"device_strs", sg_proc_devstrs_read, NULL},
{"version", sg_proc_version_read, NULL}
}; };
#define PRINT_PROC(fmt,args...) \ #define PRINT_PROC(fmt,args...) \
...@@ -2729,9 +2774,10 @@ static int ...@@ -2729,9 +2774,10 @@ static int
sg_proc_init() sg_proc_init()
{ {
int k, mask; int k, mask;
int leaves = int num_leaves =
sizeof (sg_proc_leaf_names) / sizeof (sg_proc_leaf_names[0]); sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
struct proc_dir_entry *pdep; struct proc_dir_entry *pdep;
struct sg_proc_leaf * leaf;
if (!proc_scsi) if (!proc_scsi)
return 1; return 1;
...@@ -2739,14 +2785,14 @@ sg_proc_init() ...@@ -2739,14 +2785,14 @@ sg_proc_init()
S_IFDIR | S_IRUGO | S_IXUGO, proc_scsi); S_IFDIR | S_IRUGO | S_IXUGO, proc_scsi);
if (!sg_proc_sgp) if (!sg_proc_sgp)
return 1; return 1;
for (k = 0; k < leaves; ++k) { for (k = 0; k < num_leaves; ++k) {
mask = sg_proc_leaf_writes[k] ? S_IRUGO | S_IWUSR : S_IRUGO; leaf = &sg_proc_leaf_arr[k];
pdep = mask = leaf->wf ? S_IRUGO | S_IWUSR : S_IRUGO;
create_proc_entry(sg_proc_leaf_names[k], mask, sg_proc_sgp); pdep = create_proc_entry(leaf->name, mask, sg_proc_sgp);
if (pdep) { if (pdep) {
pdep->read_proc = sg_proc_leaf_reads[k]; pdep->read_proc = leaf->rf;
if (sg_proc_leaf_writes[k]) if (leaf->wf)
pdep->write_proc = sg_proc_leaf_writes[k]; pdep->write_proc = leaf->wf;
} }
} }
return 0; return 0;
...@@ -2756,13 +2802,13 @@ static void ...@@ -2756,13 +2802,13 @@ static void
sg_proc_cleanup() sg_proc_cleanup()
{ {
int k; int k;
int leaves = int num_leaves =
sizeof (sg_proc_leaf_names) / sizeof (sg_proc_leaf_names[0]); sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
if ((!proc_scsi) || (!sg_proc_sgp)) if ((!proc_scsi) || (!sg_proc_sgp))
return; return;
for (k = 0; k < leaves; ++k) for (k = 0; k < num_leaves; ++k)
remove_proc_entry(sg_proc_leaf_names[k], sg_proc_sgp); remove_proc_entry(sg_proc_leaf_arr[k].name, sg_proc_sgp);
remove_proc_entry(sg_proc_sg_dirname, proc_scsi); remove_proc_entry(sg_proc_sg_dirname, proc_scsi);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment