Commit 40cfa05d authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-isdn.bkbits.net/linux-2.5.isdn

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 574466e8 fe8e25c3
......@@ -7,7 +7,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
......@@ -16,26 +16,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-
*
*/
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/config.h>
#include <linux/swap.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/module.h>
#include <linux/blk.h>
#include <linux/blkdev.h>
#include <linux/completion.h>
#include <linux/cdrom.h>
#include <linux/slab.h>
#include <linux/bio.h>
#include <asm/uaccess.h>
#include "../scsi/scsi.h"
#include <scsi/scsi.h>
#include <scsi/scsi_ioctl.h>
#include <asm/uaccess.h>
/* Command group 3 is reserved and should never be used. */
const unsigned char scsi_command_size[8] =
......
......@@ -3667,7 +3667,7 @@ mptscsih_bios_param(Disk * disk, kdev_t dev, int *ip)
* member to 1 if a device does not support Q tags.
*/
int
mptscsih_slave_attach(Scsi_Device *device)
mptscsih_slave_configure(Scsi_Device *device)
{
VirtDevice *pTarget;
pTarget = device->hostdata;
......
......@@ -206,12 +206,11 @@ struct mptscsih_driver_setup
#define x_scsi_dev_reset mptscsih_dev_reset
#define x_scsi_host_reset mptscsih_host_reset
#define x_scsi_bios_param mptscsih_bios_param
#define x_scsi_slave_attach mptscsih_slave_attach
#define x_scsi_slave_configure mptscsih_slave_configure
#define x_scsi_taskmgmt_bh mptscsih_taskmgmt_bh
#define x_scsi_old_abort mptscsih_old_abort
#define x_scsi_old_reset mptscsih_old_reset
#define x_scsi_slave_attach mptscsih_slave_attach
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
......@@ -235,9 +234,8 @@ extern int x_scsi_bios_param(Scsi_Device *, struct block_device *, sector_t, i
#else
extern int x_scsi_bios_param(Disk *, kdev_t, int *);
#endif
extern int x_scsi_slave_attach(Scsi_Device *);
extern int x_scsi_slave_configure(Scsi_Device *);
extern void x_scsi_taskmgmt_bh(void *);
extern int x_scsi_slave_attach(Scsi_Device *);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
#define PROC_SCSI_DECL
......@@ -256,7 +254,7 @@ extern int x_scsi_slave_attach(Scsi_Device *);
.release = x_scsi_release, \
.info = x_scsi_info, \
.queuecommand = x_scsi_queuecommand, \
.slave_attach = x_scsi_slave_attach, \
.slave_configure = x_scsi_slave_configure,\
.eh_abort_handler = x_scsi_abort, \
.eh_device_reset_handler = x_scsi_dev_reset, \
.eh_bus_reset_handler = x_scsi_bus_reset, \
......@@ -268,7 +266,6 @@ extern int x_scsi_slave_attach(Scsi_Device *);
.max_sectors = MPT_SCSI_MAX_SECTORS, \
.cmd_per_lun = MPT_SCSI_CMD_PER_LUN, \
.use_clustering = ENABLE_CLUSTERING, \
.slave_attach x_scsi_slave_attach, \
}
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
......
......@@ -170,8 +170,8 @@ STATIC int NCR_700_host_reset(Scsi_Cmnd * SCpnt);
STATIC int NCR_700_proc_directory_info(char *, char **, off_t, int, int, int);
STATIC void NCR_700_chip_setup(struct Scsi_Host *host);
STATIC void NCR_700_chip_reset(struct Scsi_Host *host);
STATIC int NCR_700_slave_attach(Scsi_Device *SDpnt);
STATIC void NCR_700_slave_detach(Scsi_Device *SDpnt);
STATIC int NCR_700_slave_configure(Scsi_Device *SDpnt);
STATIC void NCR_700_slave_destroy(Scsi_Device *SDpnt);
static char *NCR_700_phase[] = {
"",
......@@ -285,8 +285,8 @@ NCR_700_detect(Scsi_Host_Template *tpnt,
tpnt->cmd_per_lun = NCR_700_CMD_PER_LUN;
tpnt->use_clustering = DISABLE_CLUSTERING;
tpnt->proc_info = NCR_700_proc_directory_info;
tpnt->slave_attach = NCR_700_slave_attach;
tpnt->slave_detach = NCR_700_slave_detach;
tpnt->slave_configure = NCR_700_slave_configure;
tpnt->slave_destroy = NCR_700_slave_destroy;
tpnt->use_blk_tcq = 1;
tpnt->highmem_io = 1;
......@@ -1513,7 +1513,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
host->host_no, SCp, SCp == NULL ? NULL : SCp->host_scribble, dsp, dsp - hostdata->pScript);
/* clear all the negotiated parameters */
for(SDp = host->host_queue; SDp != NULL; SDp = SDp->next)
list_for_each_entry(SDp, &host->my_devices, siblings)
SDp->hostdata = 0;
/* clear all the slots and their pending commands */
......@@ -1740,7 +1740,7 @@ NCR_700_proc_directory_info(char *proc_buf, char **startp,
len += sprintf(&buf[len],"\
Target Depth Active Next Tag\n\
====== ===== ====== ========\n");
for(SDp = host->host_queue; SDp != NULL; SDp = SDp->next) {
list_for_each_entry(SDp, &host->my_devices, siblings) {
len += sprintf(&buf[len]," %2d:%2d %4d %4d %4d\n", SDp->id, SDp->lun, SDp->current_queue_depth, NCR_700_get_depth(SDp), SDp->current_tag);
}
if((len -= offset) <= 0)
......@@ -1999,7 +1999,7 @@ NCR_700_host_reset(Scsi_Cmnd * SCp)
}
STATIC int
NCR_700_slave_attach(Scsi_Device *SDp)
NCR_700_slave_configure(Scsi_Device *SDp)
{
/* to do here: allocate memory; build a queue_full list */
if(SDp->tagged_supported) {
......@@ -2012,7 +2012,7 @@ NCR_700_slave_attach(Scsi_Device *SDp)
}
STATIC void
NCR_700_slave_detach(Scsi_Device *SDp)
NCR_700_slave_destroy(Scsi_Device *SDp)
{
/* to do here: deallocate memory */
}
......
/*
Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
......@@ -2702,14 +2703,14 @@ static void BusLogic_InitializeHostStructure(BusLogic_HostAdapter_T
}
/*
BusLogic_SlaveAttach will actually set the queue depth on individual
BusLogic_SlaveConfigure will actually set the queue depth on individual
scsi devices as they are permanently added to the device chain. We
shamelessly rip off the SelectQueueDepths code to make this work mostly
like it used to. Since we don't get called once at the end of the scan
but instead get called for each device, we have to do things a bit
differently.
*/
int BusLogic_SlaveAttach(SCSI_Device_T *Device)
int BusLogic_SlaveConfigure(SCSI_Device_T *Device)
{
BusLogic_HostAdapter_T *HostAdapter =
(BusLogic_HostAdapter_T *) Device->host->hostdata;
......
......@@ -57,7 +57,7 @@ extern int BusLogic_QueueCommand(SCSI_Command_T *,
extern int BusLogic_BIOSDiskParameters(struct scsi_device *,
struct block_device *, sector_t, int *);
extern int BusLogic_ProcDirectoryInfo(char *, char **, off_t, int, int, int);
extern int BusLogic_SlaveAttach(SCSI_Device_T *);
extern int BusLogic_SlaveConfigure(SCSI_Device_T *);
/*
......@@ -72,7 +72,7 @@ extern int BusLogic_SlaveAttach(SCSI_Device_T *);
release: BusLogic_ReleaseHostAdapter, /* Release Host Adapter */ \
info: BusLogic_DriverInfo, /* Driver Info Function */ \
queuecommand: BusLogic_QueueCommand, /* Queue Command Function */ \
slave_attach: BusLogic_SlaveAttach, /* Configure a SCSI_Device*/ \
slave_configure:BusLogic_SlaveConfigure, /* Configure a SCSI_Device*/ \
bios_param: BusLogic_BIOSDiskParameters, /* BIOS Disk Parameters */ \
unchecked_isa_dma: 1, /* Default Initial Value */ \
max_sectors: 128, /* I/O queue len limit */ \
......
......@@ -865,13 +865,13 @@ static int esp_host_info(struct NCR_ESP *esp, char *ptr, off_t offset, int len)
copy_info(&info, "Target #\tconfig3\t\tSync Capabilities\tDisconnect\n");
for(i = 0; i < 15; i++) {
if(esp->targets_present & (1 << i)) {
Scsi_Device *SDptr = esp->ehost->host_queue;
Scsi_Device *SDptr;
struct esp_device *esp_dev;
while((SDptr->host != esp->ehost) &&
(SDptr->id != i) &&
(SDptr->next))
SDptr = SDptr->next;
list_for_each_entry(SDptr, &esp->ehost->my_devices,
siblings)
if(SDptr->id == i)
break;
esp_dev = SDptr->hostdata;
copy_info(&info, "%d\t\t", i);
......
......@@ -55,7 +55,6 @@
#include <linux/spinlock.h>
#include "scsi.h"
#include "hosts.h"
#include "NCR53c406a.h"
/* ============================================================= */
......
......@@ -128,7 +128,7 @@ static int aac_eh_device_reset(Scsi_Cmnd* cmd);
static int aac_eh_bus_reset(Scsi_Cmnd* cmd);
static int aac_eh_reset(Scsi_Cmnd* cmd);
static int aac_slave_attach(Scsi_Device *);
static int aac_slave_configure(Scsi_Device *);
/**
* aac_detect - Probe for aacraid cards
......@@ -518,13 +518,13 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
}
/**
* aac_slave_attach - do device specific setup
* aac_slave_configure - do device specific setup
* @dev: SCSI device we are attaching
*
* Currently, all we do is set the queue depth on the device.
*/
static int aac_slave_attach(Scsi_Device * dev )
static int aac_slave_configure(Scsi_Device * dev )
{
if(dev->tagged_supported)
......@@ -685,7 +685,7 @@ static Scsi_Host_Template driver_template = {
ioctl: aac_ioctl,
queuecommand: aac_queuecommand,
bios_param: aac_biosparm,
slave_attach: aac_slave_attach,
slave_configure: aac_slave_configure,
can_queue: AAC_NUM_IO_FIB,
this_id: 16,
sg_tablesize: 16,
......
......@@ -674,7 +674,7 @@
1. hacks for lk 2.5 series (D. Gilbert)
3.3GJD (10/14/02):
1. change select_queue_depths to slave_attach
1. change select_queue_depths to slave_configure
2. make cmd_per_lun be sane again
I. Known Problems/Fix List (XXX)
......@@ -4209,7 +4209,7 @@ STATIC PortAddr _asc_def_iop_base[];
*/
STATIC void advansys_interrupt(int, void *, struct pt_regs *);
STATIC int advansys_slave_attach(Scsi_Device *);
STATIC int advansys_slave_configure(Scsi_Device *);
STATIC void asc_scsi_done_list(Scsi_Cmnd *, int from_isr);
STATIC int asc_execute_scsi_cmnd(Scsi_Cmnd *);
STATIC int asc_build_req(asc_board_t *, Scsi_Cmnd *);
......@@ -4398,7 +4398,7 @@ advansys_proc_info(char *buffer, char **start, off_t offset, int length,
* Display target driver information for each device attached
* to the board.
*/
for (scd = shp->host_queue; scd; scd = scd->next)
list_for_each_entry (scd, &shp->my_devices, siblings)
{
if (scd->host == shp) {
cp = boardp->prtbuf;
......@@ -6345,7 +6345,7 @@ advansys_interrupt(int irq, void *dev_id, struct pt_regs *regs)
* specified host adapter.
*/
STATIC int
advansys_slave_attach(Scsi_Device *device)
advansys_slave_configure(Scsi_Device *device)
{
asc_board_t *boardp;
......@@ -6368,7 +6368,7 @@ advansys_slave_attach(Scsi_Device *device)
} else {
scsi_adjust_queue_depth(device, 0, device->host->cmd_per_lun);
}
ASC_DBG3(1, "advansys_slave_attach: shp 0x%lx, id %d, depth %d\n",
ASC_DBG3(1, "advansys_slave_configure: shp 0x%lx, id %d, depth %d\n",
(ulong) shp, device->id, device->queue_depth);
return 0;
}
......@@ -9386,8 +9386,8 @@ asc_prt_scsi_host(struct Scsi_Host *s)
#if ASC_LINUX_KERNEL24
printk(
" host_queue 0x%lx, hostt 0x%lx\n",
(ulong) s->host_queue, (ulong) s->hostt);
" hostt 0x%lx\n",
(ulong) s->hostt);
#elif ASC_LINUX_KERNEL22
printk(
" host_queue 0x%lx, hostt 0x%lx, block 0x%lx,\n",
......
......@@ -54,7 +54,7 @@ int advansys_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
int advansys_reset(Scsi_Cmnd *);
int advansys_biosparam(struct scsi_device *, struct block_device *,
sector_t, int[]);
static int advansys_slave_attach(Scsi_Device *);
static int advansys_slave_configure(Scsi_Device *);
#ifdef CONFIG_PROC_FS
#if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,3,28)
extern struct proc_dir_entry proc_scsi_advansys;
......@@ -81,7 +81,7 @@ void advansys_setup(char *, int *);
queuecommand: advansys_queuecommand, \
eh_bus_reset_handler: advansys_reset, \
bios_param: advansys_biosparam, \
slave_attach: advansys_slave_attach, \
slave_configure: advansys_slave_configure, \
/* \
* Because the driver may control an ISA adapter 'unchecked_isa_dma' \
* must be set. The flag will be cleared in advansys_detect for non-ISA \
......
......@@ -42,7 +42,6 @@ int aha152x_proc_info(char *buffer, char **start, off_t offset, int length, int
eh_bus_reset_handler: aha152x_bus_reset, \
eh_host_reset_handler: aha152x_host_reset, \
release: aha152x_release, \
slave_attach: 0, \
bios_param: aha152x_biosparam, \
can_queue: 1, \
this_id: 7, \
......
......@@ -428,7 +428,7 @@ static void ahc_linux_freeze_sim_queue(struct ahc_softc *ahc);
static void ahc_linux_release_sim_queue(u_long arg);
static int ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag);
static void ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc);
static int ahc_linux_slave_attach(Scsi_Device *device);
static int ahc_linux_slave_configure(Scsi_Device *device);
static void ahc_linux_device_queue_depth(struct ahc_softc *ahc,
Scsi_Device *device);
static struct ahc_linux_target* ahc_linux_alloc_target(struct ahc_softc*,
......@@ -1446,7 +1446,7 @@ ahc_platform_abort_scbs(struct ahc_softc *ahc, int target, char channel,
* off the input host adapter.
*/
static int
ahc_linux_slave_attach(Scsi_Device * device)
ahc_linux_slave_configure(Scsi_Device * device)
{
struct ahc_softc *ahc;
u_long flags;
......
......@@ -72,7 +72,7 @@ int ahc_linux_abort(Scsi_Cmnd *);
eh_abort_handler: ahc_linux_abort, \
eh_device_reset_handler: ahc_linux_dev_reset, \
eh_bus_reset_handler: ahc_linux_bus_reset, \
slave_attach: ahc_linux_slave_attach, \
slave_configure: ahc_linux_slave_configure, \
bios_param: AIC7XXX_BIOSPARAM, \
can_queue: 253, /* max simultaneous cmds */\
this_id: -1, /* scsi id of host adapter */\
......
This diff is collapsed.
......@@ -35,8 +35,9 @@
release: aic7xxx_release, \
info: aic7xxx_info, \
queuecommand: aic7xxx_queue, \
slave_attach: aic7xxx_slave_attach, \
slave_detach: aic7xxx_slave_detach, \
slave_alloc: aic7xxx_slave_alloc, \
slave_configure: aic7xxx_slave_configure, \
slave_destroy: aic7xxx_slave_destroy, \
bios_param: aic7xxx_biosparam, \
eh_abort_handler: aic7xxx_abort, \
eh_device_reset_handler: aic7xxx_bus_device_reset, \
......@@ -56,8 +57,9 @@ extern int aic7xxx_biosparam(struct scsi_device *, struct block_device *,
extern int aic7xxx_detect(Scsi_Host_Template *);
extern int aic7xxx_command(Scsi_Cmnd *);
extern int aic7xxx_release(struct Scsi_Host *);
extern int aic7xxx_slave_attach(Scsi_Device *);
extern void aic7xxx_slave_detach(Scsi_Device *);
static int aic7xxx_slave_alloc(Scsi_Device *);
static int aic7xxx_slave_configure(Scsi_Device *);
static void aic7xxx_slave_destroy(Scsi_Device *);
extern int aic7xxx_abort(Scsi_Cmnd *);
extern int aic7xxx_bus_device_reset(Scsi_Cmnd *);
extern int aic7xxx_reset(Scsi_Cmnd *);
......
......@@ -313,7 +313,7 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length,
p->user[tindex].options);
if(sdptr->simple_tags)
{
size += sprintf(BLS, " Tagged Command Queueing Enabled, Ordered Tags %s\n", sdptr->ordered_tags ? "Enabled" : "Disabled");
size += sprintf(BLS, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->new_queue_depth, aic_dev->max_q_depth);
}
if(aic_dev->barrier_total)
size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n",
......
......@@ -1601,7 +1601,7 @@ return -ENOTSUPP;
scsi_cdb[0] = RELEASE;
// allocate with wait = true, interruptible = false
SCpnt = scsi_allocate_device(ScsiDev, 1, 0);
SCpnt = scsi_allocate_device(ScsiDev, 1);
{
CPQFC_DECLARE_COMPLETION(wait);
......
......@@ -3487,7 +3487,6 @@ static void RevalidateSEST( struct Scsi_Host *HostAdapter,
static void UnblockScsiDevice( struct Scsi_Host *HostAdapter,
PFC_LOGGEDIN_PORT pLoggedInPort)
{
// Scsi_Device *sdev = HostAdapter->host_queue;
CPQFCHBA *cpqfcHBAdata = (CPQFCHBA *)HostAdapter->hostdata;
Scsi_Cmnd* *SCptr = &cpqfcHBAdata->LinkDnCmnd[0];
Scsi_Cmnd *Cmnd;
......
......@@ -355,7 +355,7 @@ static void adpt_inquiry(adpt_hba* pHba)
}
static int adpt_slave_attach(Scsi_Device * device)
static int adpt_slave_configure(Scsi_Device * device)
{
struct Scsi_Host *host = device->host;
adpt_hba* pHba;
......@@ -2509,20 +2509,13 @@ static void adpt_fail_posted_scbs(adpt_hba* pHba)
Scsi_Cmnd* cmd = NULL;
Scsi_Device* d = NULL;
if( pHba->host->host_queue != NULL ) {
d = pHba->host->host_queue;
if(!d){
return;
}
while( d->next != NULL ){
for(cmd = d->device_queue; cmd ; cmd = cmd->next){
if(cmd->serial_number == 0){
continue;
}
cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1);
cmd->scsi_done(cmd);
list_for_each_entry(d, &pHba->host->my_devices, siblings) {
for(cmd = d->device_queue; cmd ; cmd = cmd->next){
if(cmd->serial_number == 0){
continue;
}
d = d->next;
cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1);
cmd->scsi_done(cmd);
}
}
}
......
......@@ -44,7 +44,7 @@ static int adpt_queue(Scsi_Cmnd * cmd, void (*cmdcomplete) (Scsi_Cmnd *));
static int adpt_abort(Scsi_Cmnd * cmd);
static int adpt_reset(Scsi_Cmnd* cmd);
static int adpt_release(struct Scsi_Host *host);
static int adpt_slave_attach(Scsi_Device *);
static int adpt_slave_configure(Scsi_Device *);
static const char *adpt_info(struct Scsi_Host *pSHost);
static int adpt_bios_param(struct scsi_device * sdev, struct block_device *dev,
......@@ -93,7 +93,7 @@ static int adpt_device_reset(Scsi_Cmnd* cmd);
eh_bus_reset_handler: adpt_bus_reset, \
eh_host_reset_handler: adpt_reset, \
bios_param: adpt_bios_param, \
slave_attach: adpt_slave_attach, \
slave_configure: adpt_slave_configure, \
can_queue: MAX_TO_IOP_MESSAGES, /* max simultaneous cmds */\
this_id: 7, /* scsi id of host adapter */\
sg_tablesize: 0, /* max scatter-gather cmds */\
......
......@@ -802,7 +802,7 @@ static int pci_probe = TRUE;
static int pci_probe = FALSE;
#endif
static int eata2x_slave_attach(Scsi_Device *dev) {
static int eata2x_slave_configure(Scsi_Device *dev) {
int j, tqd, utqd;
char *tag_suffix, *link_suffix;
struct Scsi_Host *host = dev->host;
......
......@@ -9,7 +9,7 @@ static int eata2x_eh_abort(Scsi_Cmnd *);
static int eata2x_eh_host_reset(Scsi_Cmnd *);
static int eata2x_biosparam(struct scsi_device *, struct block_device *,
sector_t, int *);
static int eata2x_slave_attach(Scsi_Device *);
static int eata2x_slave_configure(Scsi_Device *);
#define EATA_VERSION "8.00.00"
......@@ -23,7 +23,7 @@ static int eata2x_slave_attach(Scsi_Device *);
eh_bus_reset_handler: NULL, \
eh_host_reset_handler: eata2x_eh_host_reset, \
bios_param: eata2x_bios_param, \
slave_attach: eata2x_slave_attach, \
slave_configure: eata2x_slave_configure, \
this_id: 7, \
unchecked_isa_dma: 1, \
use_clustering: ENABLE_CLUSTERING \
......
......@@ -431,11 +431,11 @@ int eata_proc_info(char *buffer, char **start, off_t offset, int length,
}
size = sprintf(buffer+len,"Attached devices: %s\n",
(HBA_ptr->host_queue)?"":"none");
(!list_empty(&HBA_ptr->my_devices))?"":"none");
len += size;
pos = begin + len;
for(scd = HBA_ptr->host_queue; scd; scd = scd->next) {
list_for_each_entry(scd, &HBA_ptr->my_devices, siblings) {
proc_print_scsidevice(scd, buffer, &size, len);
len += size;
pos = begin + len;
......
......@@ -81,11 +81,11 @@ int eata_pio_proc_info(char *buffer, char **start, off_t offset, int length,
goto stop_output;
size = sprintf(buffer+len,"Attached devices: %s\n",
(HBA_ptr->host_queue)?"":"none");
(!list_empty(&HBA_ptr->my_devices))?"":"none");
len += size;
pos = begin + len;
for(scd = HBA_ptr->host_queue; scd; scd = scd->next) {
list_for_each_entry(scd, &HBA_ptr->my_devices; siblings) {
proc_print_scsidevice(scd, buffer, &size, len);
len += size;
pos = begin + len;
......
......@@ -1364,13 +1364,13 @@ static int esp_host_info(struct esp *esp, char *ptr, off_t offset, int len)
copy_info(&info, "Target #\tconfig3\t\tSync Capabilities\tDisconnect\tWide\n");
for (i = 0; i < 15; i++) {
if (esp->targets_present & (1 << i)) {
Scsi_Device *SDptr = esp->ehost->host_queue;
Scsi_Device *SDptr;
struct esp_device *esp_dev;
while ((SDptr->host != esp->ehost) &&
(SDptr->id != i) &&
(SDptr->next))
SDptr = SDptr->next;
list_for_each_entry(SDptr, &esp->ehost->my_devices,
siblings)
if(SDptr->id == i)
break;
esp_dev = SDptr->hostdata;
copy_info(&info, "%d\t\t", i);
......
......@@ -70,7 +70,7 @@ static unsigned char target2alpa[] = {
static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd);
int fcal_slave_attach(Scsi_Device *device)
int fcal_slave_configure(Scsi_Device *device)
{
int depth_to_use;
......@@ -229,7 +229,7 @@ int fcal_proc_info (char *buffer, char **start, off_t offset, int length, int ho
#endif
SPRINTF ("Initiator AL-PA: %02x\n", fc->sid);
SPRINTF ("\nAttached devices: %s\n", host->host_queue ? "" : "none");
SPRINTF ("\nAttached devices: %s\n", !list_empty(&host->my_devices) ? "" : "none");
for (i = 0; i < fc->posmap->len; i++) {
unsigned char alpa = fc->posmap->list[i];
......@@ -246,8 +246,8 @@ int fcal_proc_info (char *buffer, char **start, off_t offset, int length, int ho
alpa, u1[0], u1[1], u2[0], u2[1]);
} else {
Scsi_Device *scd;
for (scd = host->host_queue ; scd; scd = scd->next)
if (scd->host->host_no == hostno && scd->id == target) {
list_for_each_entry (scd, &host->my_devices, siblings)
if (scd->id == target) {
SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ",
alpa, target, u1[0], u1[1], u2[0], u2[1]);
SPRINTF ("%s ", (scd->type < MAX_SCSI_DEVICE_CODE) ?
......
......@@ -23,7 +23,7 @@ struct fcal {
int fcal_detect(Scsi_Host_Template *);
int fcal_release(struct Scsi_Host *);
int fcal_proc_info (char *, char **, off_t, int, int, int);
int fcal_slave_attach(Scsi_Device *);
int fcal_slave_configure(Scsi_Device *);
#define FCAL { \
name: "Fibre Channel Arbitrated Loop",\
......@@ -31,7 +31,7 @@ int fcal_slave_attach(Scsi_Device *);
release: fcal_release, \
proc_info: fcal_proc_info, \
queuecommand: fcp_scsi_queuecommand, \
slave_attach: fcal_slave_attach, \
slave_configure: fcal_slave_configure, \
can_queue: FCAL_CAN_QUEUE, \
this_id: -1, \
sg_tablesize: 1, \
......
......@@ -814,7 +814,7 @@ int generic_NCR5380_proc_info(char *buffer, char **start, off_t offset, int leng
PRINTP(" %d pending writes" ANDP hostdata->pendingw);
if (hostdata->pendingr || hostdata->pendingw)
PRINTP("\n");
for (dev = scsi_ptr->host_queue; dev; dev = dev->next) {
list_for_each_entry (dev, &scsi_ptr->my_devices, siblings) {
unsigned long br = hostdata->bytes_read[dev->id];
unsigned long bw = hostdata->bytes_write[dev->id];
long tr = hostdata->time_read[dev->id] / HZ;
......
......@@ -4599,7 +4599,7 @@ static void gdth_flush(int hanum)
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_device(sdev, 1, FALSE);
scp = scsi_allocate_device(sdev, 1);
scp->cmd_len = 12;
scp->use_sg = 0;
#else
......@@ -4673,7 +4673,7 @@ void gdth_halt(void)
memset(cmnd, 0xff, MAX_COMMAND_SIZE);
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_device(sdev, 1, FALSE);
scp = scsi_allocate_device(sdev, 1);
scp->cmd_len = 12;
scp->use_sg = 0;
#else
......
......@@ -48,7 +48,7 @@ static int gdth_set_info(char *buffer,int length,int vh,int hanum,int busnum)
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_vtab[vh]);
scp = scsi_allocate_device(sdev, 1, FALSE);
scp = scsi_allocate_device(sdev, 1);
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
......@@ -712,7 +712,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_vtab[vh]);
scp = scsi_allocate_device(sdev, 1, FALSE);
scp = scsi_allocate_device(sdev, 1);
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
......
......@@ -208,6 +208,48 @@ static int scsi_remove_legacy_host(struct Scsi_Host *shost)
return 0;
}
static int scsi_check_device_busy(struct scsi_device *sdev)
{
struct Scsi_Host *shost = sdev->host;
struct scsi_cmnd *scmd;
/*
* Loop over all of the commands associated with the
* device. If any of them are busy, then set the state
* back to inactive and bail.
*/
for (scmd = sdev->device_queue; scmd; scmd = scmd->next) {
if (scmd->request && scmd->request->rq_status != RQ_INACTIVE)
goto active;
/*
* No, this device is really free. Mark it as such, and
* continue on.
*/
scmd->state = SCSI_STATE_DISCONNECTING;
if (scmd->request)
scmd->request->rq_status = RQ_SCSI_DISCONNECTING;
}
return 0;
active:
printk(KERN_ERR "SCSI device not inactive - rq_status=%d, target=%d, "
"pid=%ld, state=%d, owner=%d.\n",
scmd->request->rq_status, scmd->target,
scmd->pid, scmd->state, scmd->owner);
list_for_each_entry(sdev, &shost->my_devices, siblings) {
for (scmd = sdev->device_queue; scmd; scmd = scmd->next) {
if (scmd->request->rq_status == RQ_SCSI_DISCONNECTING)
scmd->request->rq_status = RQ_INACTIVE;
}
}
printk(KERN_ERR "Device busy???\n");
return 1;
}
/**
* scsi_remove_host - check a scsi host for release and release
* @shost: a pointer to a scsi host to release
......@@ -218,59 +260,25 @@ static int scsi_remove_legacy_host(struct Scsi_Host *shost)
int scsi_remove_host(struct Scsi_Host *shost)
{
struct scsi_device *sdev;
struct scsi_cmnd *scmd;
struct list_head *le, *lh;
/*
* FIXME Do ref counting. We force all of the devices offline to
* help prevent race conditions where other hosts/processors could
* try and get in and queue a command.
*/
for (sdev = shost->host_queue; sdev; sdev = sdev->next)
list_for_each_entry(sdev, &shost->my_devices, siblings)
sdev->online = FALSE;
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
/*
* Loop over all of the commands associated with the
* device. If any of them are busy, then set the state
* back to inactive and bail.
*/
for (scmd = sdev->device_queue; scmd; scmd = scmd->next) {
if (scmd->request && scmd->request->rq_status !=
RQ_INACTIVE) {
printk(KERN_ERR "SCSI device not inactive"
"- rq_status=%d, target=%d, pid=%ld,"
"state=%d, owner=%d.\n",
scmd->request->rq_status,
scmd->target, scmd->pid,
scmd->state, scmd->owner);
for (sdev = shost->host_queue; sdev;
sdev = sdev->next) {
for (scmd = sdev->device_queue; scmd;
scmd = scmd->next)
if (scmd->request->rq_status ==
RQ_SCSI_DISCONNECTING)
scmd->request->rq_status = RQ_INACTIVE;
}
printk(KERN_ERR "Device busy???\n");
return 1;
}
/*
* No, this device is really free. Mark it as such, and
* continue on.
*/
scmd->state = SCSI_STATE_DISCONNECTING;
if (scmd->request)
scmd->request->rq_status =
RQ_SCSI_DISCONNECTING; /* Mark as
busy */
}
}
list_for_each_entry(sdev, &shost->my_devices, siblings)
if (scsi_check_device_busy(sdev))
return 1;
/*
* Next we detach the high level drivers from the Scsi_Device
* structures
*/
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
list_for_each_entry(sdev, &shost->my_devices, siblings) {
scsi_detach_device(sdev);
/* If something still attached, punt */
......@@ -285,14 +293,8 @@ int scsi_remove_host(struct Scsi_Host *shost)
/* Next we free up the Scsi_Cmnd structures for this host */
for (sdev = shost->host_queue; sdev;
sdev = shost->host_queue) {
blk_cleanup_queue(&sdev->request_queue);
/* Next free up the Scsi_Device structures for this host */
shost->host_queue = sdev->next;
if (sdev->inquiry)
kfree(sdev->inquiry);
kfree(sdev);
list_for_each_safe(le, lh, &shost->my_devices) {
scsi_free_sdev(list_entry(le, Scsi_Device, siblings));
}
return 0;
......@@ -302,23 +304,21 @@ int scsi_add_host(struct Scsi_Host *shost)
{
Scsi_Host_Template *sht = shost->hostt;
struct scsi_device *sdev;
int error = 0;
int error = 0, saved_error = 0;
printk(KERN_INFO "scsi%d : %s\n", shost->host_no,
sht->info ? sht->info(shost) : sht->name);
device_register(&shost->host_driverfs_dev);
scan_scsis(shost, 0, 0, 0, 0);
scsi_scan_host(shost);
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
if (sdev->host->hostt != sht)
continue; /* XXX(hch): can this really happen? */
list_for_each_entry (sdev, &shost->my_devices, siblings) {
error = scsi_attach_device(sdev);
if (error)
break;
saved_error = error;
}
return error;
return saved_error;
}
/**
......@@ -370,7 +370,6 @@ extern int blk_nohighio;
struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
{
struct Scsi_Host *shost, *shost_scr;
struct list_head *lh;
int gfp_mask;
DECLARE_MUTEX_LOCKED(sem);
......@@ -401,6 +400,7 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
spin_lock_init(&shost->default_lock);
scsi_assign_lock(shost, &shost->default_lock);
atomic_set(&shost->host_active,0);
INIT_LIST_HEAD(&shost->my_devices);
init_waitqueue_head(&shost->host_wait);
shost->dma_channel = 0xff;
......@@ -449,8 +449,7 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
* orders the scsi_host_list by host number and just do a
* list_add_tail.
*/
list_for_each(lh, &scsi_host_list) {
shost_scr = list_entry(lh, struct Scsi_Host, sh_list);
list_for_each_entry(shost_scr, &scsi_host_list, sh_list) {
if (shost->host_no < shost_scr->host_no) {
__list_add(&shost->sh_list, shost_scr->sh_list.prev,
&shost_scr->sh_list);
......@@ -683,10 +682,7 @@ void __init scsi_host_init(void)
* Notes:
* Attach a single Scsi_Device to the Scsi_Host - this should
* be made to look like a "pseudo-device" that points to the
* HA itself. For the moment, we include it at the head of
* the host_queue itself - I don't think we want to show this
* to the HA in select_queue_depths(), as this would probably confuse
* matters.
* HA itself.
*
* Note - this device is not accessible from any high-level
* drivers (including generics), which is probably not
......
......@@ -187,59 +187,73 @@ typedef struct SHT
int (*reset)(int,int);
/*
* Once the device has responded to an INQUIRY and we know the device
* is online, call into the low level driver with the Scsi_Device *
* (so that the low level driver may save it off in a safe location
* for later use in calling scsi_adjust_queue_depth() or possibly
* other scsi_* functions) and char * to the INQUIRY return data buffer.
* This way, low level drivers will no longer have to snoop INQUIRY data
* to see if a drive supports PPR message protocol for Ultra160 speed
* negotiations or other similar items. Instead it can simply wait until
* the scsi mid layer calls them with the data in hand and then it can
* do it's checking of INQUIRY data. This will happen once for each new
* device added on this controller (including once for each lun on
* multi-lun devices, so low level drivers should take care to make
* sure that if they do tagged queueing on a per physical unit basis
* instead of a per logical unit basis that they have the mid layer
* allocate tags accordingly).
* slave_alloc() - Optional
*
* Before the mid layer attempts to scan for a new device where none
* currently exists, it will call this entry in your driver. Should
* your driver need to allocate any structs or perform any other init
* items in order to send commands to a currently unused target/lun
* combo, then this is where you can perform those allocations. This
* is specifically so that drivers won't have to perform any kind of
* "is this a new device" checks in their queuecommand routine,
* thereby making the hot path a bit quicker.
*
* Return values: 0 on success, non-0 on failure
*
* Deallocation: If we didn't find any devices at this ID, you will
* get an immediate call to slave_destroy(). If we find something here
* then you will get a call to slave_configure(), then the device will be
* used for however long it is kept around, then when the device is
* removed from the system (or * possibly at reboot time), you will
* then get a call to slave_detach(). This is assuming you implement
* slave_configure and slave_destroy. However, if you allocate memory
* and hang it off the device struct, then you must implement the
* slave_destroy() routine at a minimum in order to avoid leaking memory
* each time a device is tore down.
*/
int (* slave_alloc)(Scsi_Device *);
/*
* slave_configure() - Optional
*
* Once the device has responded to an INQUIRY and we know the device
* is online, we call into the low level driver with the Scsi_Device *
* If the low level device driver implements this function, it *must*
* perform the task of setting the queue depth on the device. All other
* tasks are optional and depend on what the driver supports and various
* implementation details.
*
* Things currently recommended to be handled at this time include:
*
* 1. Checking for tagged queueing capability and if able then calling
* scsi_adjust_queue_depth() with the device pointer and the
* suggested new queue depth.
* 2. Checking for things such as SCSI level or DT bit in order to
* determine if PPR message protocols are appropriate on this
* device (or any other scsi INQUIRY data specific things the
* driver wants to know in order to properly handle this device).
* 1. Setting the device queue depth. Proper setting of this is
* described in the comments for scsi_adjust_queue_depth.
* 2. Determining if the device supports the various synchronous
* negotiation protocols. The device struct will already have
* responded to INQUIRY and the results of the standard items
* will have been shoved into the various device flag bits, eg.
* device->sdtr will be true if the device supports SDTR messages.
* 3. Allocating command structs that the device will need.
* 4. Setting the default timeout on this device (if needed).
* 5. Saving the Scsi_Device pointer so that the low level driver
* will be able to easily call back into scsi_adjust_queue_depth
* again should it be determined that the queue depth for this
* device should be lower or higher than it is initially set to.
* 6. Allocate device data structures as needed that can be attached
* to the Scsi_Device * via SDpnt->host_device_ptr
* 7. Anything else the low level driver might want to do on a device
* 5. Anything else the low level driver might want to do on a device
* specific setup basis...
* 8. Return 0 on success, non-0 on error. The device will be marked
* as offline on error so that no access will occur.
* 6. Return 0 on success, non-0 on error. The device will be marked
* as offline on error so that no access will occur. If you return
* non-0, your slave_detach routine will never get called for this
* device, so don't leave any loose memory hanging around, clean
* up after yourself before returning non-0
*/
int (* slave_attach)(Scsi_Device *);
int (* slave_configure)(Scsi_Device *);
/*
* If we are getting ready to remove a device from the scsi chain then
* we call into the low level driver to let them know. Once a low
* level driver has been informed that a drive is going away, the low
* level driver *must* remove it's pointer to the Scsi_Device because
* it is going to be kfree()'ed shortly. It is no longer safe to call
* any mid layer functions with this Scsi_Device *. Additionally, the
* mid layer will not make any more calls into the low level driver's
* queue routine with this device, so it is safe for the device driver
* to deallocate all structs/commands/etc that is has allocated
* specifically for this device at the time of this call.
* slave_destroy() - Optional
*
* Immediately prior to deallocating the device and after all activity
* has ceased the mid layer calls this point so that the low level driver
* may completely detach itself from the scsi device and vice versa.
* The low level driver is responsible for freeing any memory it allocated
* in the slave_alloc or slave_configure calls.
*/
void (* slave_detach)(Scsi_Device *);
void (* slave_destroy)(Scsi_Device *);
/*
* This function determines the bios parameters for a given
......@@ -359,8 +373,6 @@ struct Scsi_Host
* struct private is a way of marking it in a sort of C++ type of way.
*/
struct list_head sh_list;
Scsi_Device * host_queue;
struct list_head all_scsi_hosts;
struct list_head my_devices;
spinlock_t default_lock;
......@@ -519,7 +531,7 @@ static inline void scsi_set_pci_device(struct Scsi_Host *shost,
/*
* Prototypes for functions/data in scsi_scan.c
*/
extern void scan_scsis(struct Scsi_Host *, uint, uint, uint, uint);
extern void scsi_scan_host(struct Scsi_Host *);
struct Scsi_Device_Template
{
......@@ -585,9 +597,7 @@ static inline Scsi_Device *scsi_find_device(struct Scsi_Host *shost,
int channel, int pun, int lun) {
Scsi_Device *sdev;
for (sdev = shost->host_queue;
sdev != NULL;
sdev = sdev->next)
list_for_each_entry (sdev, &shost->my_devices, siblings)
if (sdev->channel == channel && sdev->id == pun
&& sdev->lun ==lun)
break;
......
......@@ -105,7 +105,6 @@ extern int i91u_biosparam(struct scsi_device *, struct block_device *,
eh_host_reset_handler: NULL, \
abort: i91u_abort, \
reset: i91u_reset, \
slave_attach: NULL, \
bios_param: i91u_biosparam, \
can_queue: 1, \
this_id: 1, \
......
......@@ -433,7 +433,7 @@ int ips_eh_reset(Scsi_Cmnd *);
int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *));
int ips_biosparam(struct scsi_device *, struct block_device *,
sector_t, int *);
int ips_slave_attach(Scsi_Device *);
int ips_slave_configure(Scsi_Device *);
const char * ips_info(struct Scsi_Host *);
void do_ipsintr(int, void *, struct pt_regs *);
static int ips_hainit(ips_ha_t *);
......@@ -1866,7 +1866,7 @@ ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) {
/****************************************************************************/
/* */
/* Routine Name: ips_slave_attach */
/* Routine Name: ips_slave_configure */
/* */
/* Routine Description: */
/* */
......@@ -1874,7 +1874,7 @@ ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) {
/* */
/****************************************************************************/
int
ips_slave_attach(Scsi_Device *SDptr)
ips_slave_configure(Scsi_Device *SDptr)
{
ips_ha_t *ha;
int min;
......
......@@ -61,7 +61,7 @@
extern int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *));
extern int ips_biosparam(struct scsi_device *, struct block_device *,
sector_t, int *);
extern int ips_slave_attach(Scsi_Device *);
extern int ips_slave_configure(Scsi_Device *);
extern const char * ips_info(struct Scsi_Host *);
extern void do_ips(int, void *, struct pt_regs *);
......@@ -471,7 +471,7 @@
queuecommand : ips_queue, \
eh_abort_handler : ips_eh_abort, \
eh_host_reset_handler : ips_eh_reset, \
slave_attach : ips_slave_attach, \
slave_configure : ips_slave_configure,\
bios_param : ips_biosparam, \
can_queue : 0, \
this_id: -1, \
......
......@@ -974,13 +974,11 @@ static void mega_build_kernel_sg (char *barea, ulong xfersize, mega_scb * pScb,
mega_ioctl_mbox * mbox);
#endif
static int megadev_open (struct inode *, struct file *);
static int megadev_ioctl_entry (struct inode *, struct file *,
unsigned int, unsigned long);
static int megadev_ioctl (struct inode *, struct file *,
unsigned int, unsigned long);
static mega_scb *megadev_doioctl (mega_host_config *, Scsi_Cmnd *);
static int megadev_close (struct inode *, struct file *);
static void megadev_ioctl_done (Scsi_Cmnd *);
static int mega_init_scb (mega_host_config *);
static void enq_scb_freelist (mega_host_config *, mega_scb *,
......
......@@ -8496,7 +8496,7 @@ static void __init ncr_getclock (ncb_p np, int mult)
** Linux select queue depths function
*/
int ncr53c8xx_slave_attach(Scsi_Device *device)
int ncr53c8xx_slave_configure(Scsi_Device *device)
{
struct Scsi_Host *host = device->host;
ncb_p np;
......
......@@ -59,7 +59,7 @@ int ncr53c8xx_detect(Scsi_Host_Template *tpnt);
const char *ncr53c8xx_info(struct Scsi_Host *host);
int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int);
int ncr53c8xx_slave_attach(Scsi_Device *);
int ncr53c8xx_slave_configure(Scsi_Device *);
#ifdef MODULE
int ncr53c8xx_release(struct Scsi_Host *);
......@@ -75,7 +75,7 @@ int ncr53c8xx_release(struct Scsi_Host *);
release: ncr53c8xx_release, \
info: ncr53c8xx_info, \
queuecommand: ncr53c8xx_queue_command,\
slave_attach: ncr53c8xx_slave_attach, \
slave_configure:ncr53c8xx_slave_configure,\
abort: ncr53c8xx_abort, \
reset: ncr53c8xx_reset, \
can_queue: SCSI_NCR_CAN_QUEUE, \
......
......@@ -297,7 +297,7 @@ static void aha152x_config_cs(dev_link_t *link)
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template)
for (dev = host->host_queue; dev; dev = dev->next) {
list_for_each_entry (dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
......
......@@ -261,7 +261,7 @@ static void fdomain_config(dev_link_t *link)
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template)
for (dev = host->host_queue; dev; dev = dev->next) {
list_for_each_entry (dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
......
......@@ -1779,7 +1779,7 @@ static void nsp_cs_config(dev_link_t *link)
for (host = scsi_hostlist; host != NULL; host = host->next) {
#endif
if (host->hostt == &driver_template) {
for (dev = host->host_queue; dev != NULL; dev = dev->next) {
list_for_each_entry (dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
......
......@@ -284,7 +284,7 @@ static void qlogic_config(dev_link_t *link)
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template)
for (dev = host->host_queue; dev; dev = dev->next) {
list_for_each_entry (dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
......
......@@ -71,7 +71,7 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt)
up(&fc_sem);
}
int pluto_slave_attach(Scsi_Device *device)
int pluto_slave_configure(Scsi_Device *device)
{
int depth_to_use;
......
......@@ -41,7 +41,7 @@ struct pluto_inquiry {
int pluto_detect(Scsi_Host_Template *);
int pluto_release(struct Scsi_Host *);
const char * pluto_info(struct Scsi_Host *);
int pluto_slave_attach(Scsi_Device *);
int pluto_slave_configure(Scsi_Device *);
#define PLUTO { \
name: "Sparc Storage Array 100/200", \
......@@ -49,7 +49,7 @@ int pluto_slave_attach(Scsi_Device *);
release: pluto_release, \
info: pluto_info, \
queuecommand: fcp_scsi_queuecommand, \
slave_attach: pluto_slave_attach, \
slave_configure: pluto_slave_configure, \
can_queue: PLUTO_CAN_QUEUE, \
this_id: -1, \
sg_tablesize: 1, \
......
......@@ -381,7 +381,7 @@ static void qla1280_done(struct scsi_qla_host *, srb_t **, srb_t **);
static void qla1280_next(struct scsi_qla_host *, scsi_lu_t *, int);
static void qla1280_putq_t(scsi_lu_t *, srb_t *);
static void qla1280_done_q_put(srb_t *, srb_t **, srb_t **);
static int qla1280_slave_attach(Scsi_Device *);
static int qla1280_slave_configure(Scsi_Device *);
#if STOP_ON_ERROR
static void qla1280_panic(char *, struct Scsi_Host *host);
#endif
......@@ -1794,7 +1794,7 @@ qla1280_do_dpc(void *p)
}
/**************************************************************************
* qla1280_slave_attach
* qla1280_slave_configure
*
* Description:
* Determines the queue depth for a given device. There are two ways
......@@ -1805,7 +1805,7 @@ qla1280_do_dpc(void *p)
* default queue depth (dependent on the number of hardware SCBs).
**************************************************************************/
static int
qla1280_slave_attach(Scsi_Device * device)
qla1280_slave_configure(Scsi_Device * device)
{
struct scsi_qla_host *p = (struct scsi_qla_host *)device->host->hostdata;
int bus = device->channel;
......
......@@ -1315,7 +1315,7 @@ int qla1280_abort(Scsi_Cmnd *);
int qla1280_reset(Scsi_Cmnd *, unsigned int);
int qla1280_biosparam(struct scsi_device *, struct block_device *,
sector_t, int[]);
static int qla1280_slave_attach(Scsi_Device *);
static int qla1280_slave_configure(Scsi_Device *);
void qla1280_intr_handler(int, void *, struct pt_regs *);
void qla1280_setup(char *s, int *dummy);
......@@ -1334,7 +1334,7 @@ void qla1280_setup(char *s, int *dummy);
/* use_new_eh_code: 0, */ \
abort: qla1280_abort, \
reset: qla1280_reset, \
slave_attach: qla1280_slave_attach, \
slave_configure: qla1280_slave_configure, \
bios_param: qla1280_biosparam, \
can_queue: 255, /* max simultaneous cmds */\
this_id: -1, /* scsi id of host adapter */\
......
This diff is collapsed.
......@@ -15,23 +15,10 @@
#ifndef _SCSI_H
#define _SCSI_H
#include <linux/config.h> /* for CONFIG_SCSI_LOGGING */
#include <linux/devfs_fs_kernel.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
/*
* Some of the public constants are being moved to this file.
* We include it here so that what came from where is transparent.
*/
#include <linux/config.h> /* for CONFIG_SCSI_LOGGING */
#include <linux/devfs_fs_kernel.h> /* some morons don't know struct pointers */
#include <scsi/scsi.h>
#include <linux/random.h>
#include <asm/hardirq.h>
#include <asm/scatterlist.h>
#include <asm/io.h>
/*
* These are the values that the SCpnt->sc_data_direction and
......@@ -396,6 +383,7 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
* Forward-declaration of structs for prototypes.
*/
struct Scsi_Host;
struct scatterlist;
/*
* Add some typedefs so that we can prototyope a bunch of the functions.
......@@ -445,10 +433,6 @@ void scsi_free_sgtable(struct scatterlist *sgl, int index);
* Prototypes for functions in scsi_lib.c
*/
extern int scsi_maybe_unblock_host(Scsi_Device * SDpnt);
extern Scsi_Cmnd *scsi_end_request(Scsi_Cmnd * SCpnt, int uptodate,
int sectors);
extern struct Scsi_Device_Template *scsi_get_request_dev(struct request *);
extern int scsi_init_cmd_errh(Scsi_Cmnd * SCpnt);
extern void scsi_setup_cmd_retry(Scsi_Cmnd *SCpnt);
extern int scsi_insert_special_cmd(Scsi_Cmnd * SCpnt, int);
extern void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
......@@ -466,12 +450,13 @@ extern void scsi_bottom_half_handler(void);
extern void scsi_release_commandblocks(Scsi_Device * SDpnt);
extern void scsi_build_commandblocks(Scsi_Device * SDpnt);
extern void scsi_adjust_queue_depth(Scsi_Device *, int, int);
extern int scsi_track_queue_full(Scsi_Device *, int);
extern int scsi_slave_attach(struct scsi_device *sdev);
extern void scsi_slave_detach(struct scsi_device *sdev);
extern void scsi_done(Scsi_Cmnd * SCpnt);
extern void scsi_finish_command(Scsi_Cmnd *);
extern int scsi_retry_command(Scsi_Cmnd *);
extern Scsi_Cmnd *scsi_allocate_device(Scsi_Device *, int, int);
extern Scsi_Cmnd *scsi_allocate_device(Scsi_Device *, int);
extern void __scsi_release_command(Scsi_Cmnd *);
extern void scsi_release_command(Scsi_Cmnd *);
extern void scsi_do_cmd(Scsi_Cmnd *, const void *cmnd,
......@@ -525,6 +510,8 @@ static inline void scsi_proc_host_rm(struct Scsi_Host *);
extern struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *,
uint, uint, uint);
extern void scsi_free_sdev(struct scsi_device *);
extern int scsi_add_single_device(uint, uint, uint, uint);
extern int scsi_remove_single_device(uint, uint, uint, uint);
/*
* Prototypes for functions in constants.c
......@@ -551,7 +538,7 @@ struct dev_info {
unsigned flags;
};
extern struct dev_info scsi_static_device_list[] __initdata;
extern struct dev_info scsi_static_device_list[];
/*
* scsi_dev_info_list: structure to hold black/white listed devices.
......@@ -599,6 +586,11 @@ struct scsi_device {
Scsi_Cmnd *current_cmnd; /* currently active command */
unsigned short current_queue_depth;/* How deep of a queue we have */
unsigned short new_queue_depth; /* How deep of a queue we want */
unsigned short last_queue_full_depth; /* These two are used by */
unsigned short last_queue_full_count; /* scsi_track_queue_full() */
unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same
jiffie count on our counter, they
could all be from the same event. */
unsigned int id, lun, channel;
......
......@@ -812,13 +812,13 @@ static void timer_intr_handler(unsigned long indx)
spin_unlock_irqrestore(&queued_arr_lock, iflags);
}
static int scsi_debug_slave_attach(struct scsi_device * sdp)
static int scsi_debug_slave_configure(struct scsi_device * sdp)
{
int k;
struct sdebug_dev_info * devip;
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
printk(KERN_INFO "scsi_debug: slave_attach <%u %u %u %u>\n",
printk(KERN_INFO "scsi_debug: slave_configure <%u %u %u %u>\n",
sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN)
sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN;
......@@ -838,13 +838,13 @@ static int scsi_debug_slave_attach(struct scsi_device * sdp)
return 0;
}
static void scsi_debug_slave_detach(struct scsi_device * sdp)
static void scsi_debug_slave_destroy(struct scsi_device * sdp)
{
struct sdebug_dev_info * devip =
(struct sdebug_dev_info *)sdp->hostdata;
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
printk(KERN_INFO "scsi_debug: slave_detach <%u %u %u %u>\n",
printk(KERN_INFO "scsi_debug: slave_destroy <%u %u %u %u>\n",
sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
if (devip) {
/* make this slot avaliable for re-use */
......
......@@ -2,8 +2,8 @@
#include <linux/types.h>
static int scsi_debug_slave_attach(struct scsi_device *);
static void scsi_debug_slave_detach(struct scsi_device *);
static int scsi_debug_slave_configure(struct scsi_device *);
static void scsi_debug_slave_destroy(struct scsi_device *);
static int scsi_debug_queuecommand(struct scsi_cmnd *,
void (*done) (struct scsi_cmnd *));
static int scsi_debug_ioctl(struct scsi_device *, int, void *);
......@@ -27,8 +27,8 @@ static Scsi_Host_Template sdebug_driver_template = {
.proc_info = scsi_debug_proc_info,
.name = "SCSI DEBUG",
.info = scsi_debug_info,
.slave_attach = scsi_debug_slave_attach,
.slave_detach = scsi_debug_slave_detach,
.slave_configure = scsi_debug_slave_configure,
.slave_destroy = scsi_debug_slave_destroy,
.ioctl = scsi_debug_ioctl,
.queuecommand = scsi_debug_queuecommand,
.eh_abort_handler = scsi_debug_abort,
......
......@@ -201,7 +201,7 @@ static void scsi_eh_prt_fail_stats(Scsi_Cmnd *sc_list, struct Scsi_Host *shost)
int devices_failed = 0;
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
list_for_each_entry(sdev, &shost->my_devices, siblings) {
for (scmd = sc_list; scmd; scmd = scmd->bh_next) {
if (scmd->device == sdev) {
++total_failures;
......@@ -246,7 +246,8 @@ static void scsi_eh_get_failed(Scsi_Cmnd **sc_list, struct Scsi_Host *shost)
Scsi_Device *sdev;
Scsi_Cmnd *scmd;
for (found = 0, sdev = shost->host_queue; sdev; sdev = sdev->next) {
found = 0;
list_for_each_entry(sdev, &shost->my_devices, siblings) {
for (scmd = sdev->device_queue; scmd; scmd = scmd->next) {
if (scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR)) {
scmd->bh_next = *sc_list;
......@@ -961,7 +962,7 @@ static int scsi_eh_bus_device_reset(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Trying BDR\n", __FUNCTION__));
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
list_for_each_entry(sdev, &shost->my_devices, siblings) {
for (scmd = sc_todo; scmd; scmd = scmd->bh_next)
if ((scmd->device == sdev) &&
scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR))
......@@ -1015,7 +1016,7 @@ static int scsi_try_bus_reset(Scsi_Cmnd *scmd)
/*
* Mark all affected devices to expect a unit attention.
*/
for (sdev = scmd->host->host_queue; sdev; sdev = sdev->next)
list_for_each_entry(sdev, &scmd->host->my_devices, siblings)
if (scmd->channel == sdev->channel) {
sdev->was_reset = 1;
sdev->expecting_cc_ua = 1;
......@@ -1051,7 +1052,7 @@ static int scsi_try_host_reset(Scsi_Cmnd *scmd)
/*
* Mark all affected devices to expect a unit attention.
*/
for (sdev = scmd->host->host_queue; sdev; sdev = sdev->next)
list_for_each_entry(sdev, &scmd->host->my_devices, siblings)
if (scmd->channel == sdev->channel) {
sdev->was_reset = 1;
sdev->expecting_cc_ua = 1;
......@@ -1457,7 +1458,7 @@ static void scsi_restart_operations(struct Scsi_Host *shost)
* onto the head of the SCSI request queue for the device. There
* is no point trying to lock the door of an off-line device.
*/
for (sdev = shost->host_queue; sdev; sdev = sdev->next)
list_for_each_entry(sdev, &shost->my_devices, siblings)
if (sdev->online && sdev->locked)
scsi_eh_lock_door(sdev);
......@@ -1478,7 +1479,7 @@ static void scsi_restart_operations(struct Scsi_Host *shost)
* requests are started.
*/
spin_lock_irqsave(shost->host_lock, flags);
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
list_for_each_entry(sdev, &shost->my_devices, siblings) {
if ((shost->can_queue > 0 &&
(shost->host_busy >= shost->can_queue))
|| (shost->host_blocked)
......
......@@ -12,6 +12,7 @@
#include <linux/bio.h>
#include <linux/kernel.h>
#include <linux/blk.h>
#include <asm/hardirq.h>
#include <linux/smp_lock.h>
#include <linux/completion.h>
......@@ -95,7 +96,7 @@ int scsi_insert_special_req(Scsi_Request * SRpnt, int at_head)
* fields related to error handling. Typically this will
* be called once for each command, as required.
*/
int scsi_init_cmd_errh(Scsi_Cmnd * SCpnt)
static int scsi_init_cmd_errh(Scsi_Cmnd * SCpnt)
{
SCpnt->owner = SCSI_OWNER_MIDLEVEL;
SCpnt->reset_chain = NULL;
......@@ -241,7 +242,7 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
* use function pointers to pick the right one.
*/
if (SDpnt->single_lun && blk_queue_empty(q) && SDpnt->device_busy ==0) {
for (SDpnt = SHpnt->host_queue; SDpnt; SDpnt = SDpnt->next) {
list_for_each_entry(SDpnt, &SHpnt->my_devices, siblings) {
if (((SHpnt->can_queue > 0)
&& (SHpnt->host_busy >= SHpnt->can_queue))
|| (SHpnt->host_blocked)
......@@ -264,7 +265,7 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
*/
all_clear = 1;
if (SHpnt->some_device_starved) {
for (SDpnt = SHpnt->host_queue; SDpnt; SDpnt = SDpnt->next) {
list_for_each_entry(SDpnt, &SHpnt->my_devices, siblings) {
if ((SHpnt->can_queue > 0 && (SHpnt->host_busy >= SHpnt->can_queue))
|| (SHpnt->host_blocked)
|| (SHpnt->host_self_blocked)) {
......@@ -306,11 +307,10 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
* We are guaranteeing that the request queue will be goosed
* at some point during this call.
*/
static Scsi_Cmnd *__scsi_end_request(Scsi_Cmnd * SCpnt,
static Scsi_Cmnd *scsi_end_request(Scsi_Cmnd * SCpnt,
int uptodate,
int sectors,
int requeue,
int frequeue)
int requeue)
{
request_queue_t *q = &SCpnt->device->request_queue;
struct request *req = SCpnt->request;
......@@ -337,12 +337,9 @@ static Scsi_Cmnd *__scsi_end_request(Scsi_Cmnd * SCpnt,
add_disk_randomness(req->rq_disk);
spin_lock_irqsave(q->queue_lock, flags);
if (blk_rq_tagged(req))
blk_queue_end_tag(q, req);
end_that_request_last(req);
spin_unlock_irqrestore(q->queue_lock, flags);
/*
......@@ -350,38 +347,10 @@ static Scsi_Cmnd *__scsi_end_request(Scsi_Cmnd * SCpnt,
* need to worry about launching another command.
*/
__scsi_release_command(SCpnt);
if (frequeue)
scsi_queue_next_request(q, NULL);
scsi_queue_next_request(q, NULL);
return NULL;
}
/*
* Function: scsi_end_request()
*
* Purpose: Post-processing of completed commands called from interrupt
* handler or a bottom-half handler.
*
* Arguments: SCpnt - command that is complete.
* uptodate - 1 if I/O indicates success, 0 for I/O error.
* sectors - number of sectors we want to mark.
*
* Lock status: Assumed that lock is not held upon entry.
*
* Returns: Nothing
*
* Notes: This is called for block device requests in order to
* mark some number of sectors as complete.
*
* We are guaranteeing that the request queue will be goosed
* at some point during this call.
*/
Scsi_Cmnd *scsi_end_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors)
{
return __scsi_end_request(SCpnt, uptodate, sectors, 1, 1);
}
/*
* Function: scsi_release_buffers()
*
......@@ -428,6 +397,29 @@ static void scsi_release_buffers(Scsi_Cmnd * SCpnt)
SCpnt->request_bufflen = 0;
}
/*
* Function: scsi_get_request_dev()
*
* Purpose: Find the upper-level driver that is responsible for this
* request
*
* Arguments: request - I/O request we are preparing to queue.
*
* Lock status: No locks assumed to be held, but as it happens the
* q->queue_lock is held when this is called.
*
* Returns: Nothing
*
* Notes: The requests in the request queue may have originated
* from any block device driver. We need to find out which
* one so that we can later form the appropriate command.
*/
static struct Scsi_Device_Template *scsi_get_request_dev(struct request *req)
{
struct gendisk *p = req->rq_disk;
return p ? *(struct Scsi_Device_Template **)p->private_data : NULL;
}
/*
* Function: scsi_io_completion()
*
......@@ -527,11 +519,7 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
* requeueing right here - we will requeue down below
* when we handle the bad sectors.
*/
SCpnt = __scsi_end_request(SCpnt,
1,
good_sectors,
result == 0,
1);
SCpnt = scsi_end_request(SCpnt, 1, good_sectors, result == 0);
/*
* If the command completed without error, then either finish off the
......@@ -574,7 +562,8 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
* and quietly refuse further access.
*/
SCpnt->device->changed = 1;
SCpnt = scsi_end_request(SCpnt, 0, this_count);
SCpnt = scsi_end_request(SCpnt, 0,
this_count, 1);
return;
} else {
/*
......@@ -606,14 +595,14 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
scsi_queue_next_request(q, SCpnt);
result = 0;
} else {
SCpnt = scsi_end_request(SCpnt, 0, this_count);
SCpnt = scsi_end_request(SCpnt, 0, this_count, 1);
return;
}
break;
case NOT_READY:
printk(KERN_INFO "Device %s not ready.\n",
req->rq_disk ? req->rq_disk->disk_name : "");
SCpnt = scsi_end_request(SCpnt, 0, this_count);
SCpnt = scsi_end_request(SCpnt, 0, this_count, 1);
return;
break;
case MEDIUM_ERROR:
......@@ -623,7 +612,7 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
(int) SCpnt->target, (int) SCpnt->lun);
print_command(SCpnt->data_cmnd);
print_sense("sd", SCpnt);
SCpnt = scsi_end_request(SCpnt, 0, block_sectors);
SCpnt = scsi_end_request(SCpnt, 0, block_sectors, 1);
return;
default:
break;
......@@ -656,34 +645,11 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
* We sometimes get this cruft in the event that a medium error
* isn't properly reported.
*/
SCpnt = scsi_end_request(SCpnt, 0, req->current_nr_sectors);
SCpnt = scsi_end_request(SCpnt, 0, req->current_nr_sectors, 1);
return;
}
}
/*
* Function: scsi_get_request_dev()
*
* Purpose: Find the upper-level driver that is responsible for this
* request
*
* Arguments: request - I/O request we are preparing to queue.
*
* Lock status: No locks assumed to be held, but as it happens the
* q->queue_lock is held when this is called.
*
* Returns: Nothing
*
* Notes: The requests in the request queue may have originated
* from any block device driver. We need to find out which
* one so that we can later form the appropriate command.
*/
struct Scsi_Device_Template *scsi_get_request_dev(struct request *req)
{
struct gendisk *p = req->rq_disk;
return p ? *(struct Scsi_Device_Template **)p->private_data : NULL;
}
/*
* Function: scsi_init_io()
*
......@@ -763,7 +729,7 @@ static int scsi_init_io(Scsi_Cmnd *SCpnt)
/*
* kill it. there should be no leftover blocks in this request
*/
SCpnt = scsi_end_request(SCpnt, 0, req->nr_sectors);
SCpnt = scsi_end_request(SCpnt, 0, req->nr_sectors, 1);
BUG_ON(SCpnt);
ret = BLKPREP_KILL;
out:
......@@ -797,8 +763,7 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
SRpnt = (Scsi_Request *) req->special;
if( SRpnt->sr_magic == SCSI_REQ_MAGIC ) {
SCpnt = scsi_allocate_device(SRpnt->sr_device,
FALSE, FALSE);
SCpnt = scsi_allocate_device(SRpnt->sr_device, 0);
if (!SCpnt)
return BLKPREP_DEFER;
scsi_init_cmd_from_req(SCpnt, SRpnt);
......@@ -809,9 +774,9 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
* Now try and find a command block that we can use.
*/
if (req->special) {
SCpnt = (Scsi_Cmnd *) req->special;
SCpnt = (Scsi_Cmnd *) req->special;
} else {
SCpnt = scsi_allocate_device(SDpnt, FALSE, FALSE);
SCpnt = scsi_allocate_device(SDpnt, 0);
}
/*
* if command allocation failure, wait a bit
......@@ -1085,7 +1050,7 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt)
SHpnt->host_self_blocked = FALSE;
/* Now that we are unblocked, try to start the queues. */
for (SDloop = SHpnt->host_queue; SDloop; SDloop = SDloop->next)
list_for_each_entry(SDloop, &SHpnt->my_devices, siblings)
scsi_queue_next_request(&SDloop->request_queue, NULL);
}
......@@ -1113,7 +1078,7 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt)
void scsi_report_bus_reset(struct Scsi_Host * SHpnt, int channel)
{
Scsi_Device *SDloop;
for (SDloop = SHpnt->host_queue; SDloop; SDloop = SDloop->next) {
list_for_each_entry(SDloop, &SHpnt->my_devices, siblings) {
if (channel == SDloop->channel) {
SDloop->was_reset = 1;
SDloop->expecting_cc_ua = 1;
......
......@@ -16,14 +16,13 @@
* Michael A. Griffith <grif@acm.org>
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/errno.h>
#include <linux/stat.h>
#include <linux/blk.h>
#include <asm/uaccess.h>
......@@ -282,7 +281,7 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, int length)
*/
for (shost = scsi_host_get_next(NULL); shost;
shost = scsi_host_get_next(shost)) {
if (shost->host_queue != NULL) {
if (!list_empty(&shost->my_devices)) {
break;
}
}
......@@ -292,7 +291,7 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, int length)
pos = begin + len;
for (shost = scsi_host_get_next(NULL); shost;
shost = scsi_host_get_next(shost)) {
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
list_for_each_entry(sdev, &shost->my_devices, siblings) {
proc_print_scsidevice(sdev, buffer, &size, len);
len += size;
pos = begin + len;
......@@ -360,7 +359,7 @@ static void scsi_dump_status(int level)
shpnt = scsi_host_get_next(shpnt)) {
printk(KERN_INFO "h:c:t:l (dev sect nsect cnumsec sg) "
"(ret all flg) (to/cmd to ito) cmd snse result\n");
for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) {
list_for_each_entry(SDpnt, &shpnt->my_devices, siblings) {
for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->next) {
/* (0) h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result %d %x */
printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4llu %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n",
......@@ -399,11 +398,8 @@ static void scsi_dump_status(int level)
static int proc_scsi_gen_write(struct file * file, const char * buf,
unsigned long length, void *data)
{
Scsi_Device *sdev;
struct Scsi_Host *shost;
char *p;
int host, channel, id, lun;
char * buffer;
char *buffer, *p;
int err;
if (!buf || length>PAGE_SIZE)
......@@ -529,35 +525,9 @@ static int proc_scsi_gen_write(struct file * file, const char * buf,
id = simple_strtoul(p + 1, &p, 0);
lun = simple_strtoul(p + 1, &p, 0);
printk(KERN_INFO "scsi singledevice %d %d %d %d\n", host, channel,
id, lun);
for (shost = scsi_host_get_next(NULL); shost;
shost = scsi_host_get_next(shost)) {
if (shost->host_no == host) {
break;
}
}
err = -ENXIO;
if (!shost)
goto out;
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
if ((sdev->channel == channel
&& sdev->id == id
&& sdev->lun == lun)) {
break;
}
}
err = -ENOSYS;
if (sdev)
goto out; /* We do not yet support unplugging */
scan_scsis(shost, 1, channel, id, lun);
err = length;
goto out;
}
err = scsi_add_single_device(host, channel, id, lun);
if (err >= 0)
err = length;
/*
* Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi
* with "0 1 2 3" replaced by your "Host Channel Id Lun".
......@@ -569,7 +539,7 @@ static int proc_scsi_gen_write(struct file * file, const char * buf,
* hardware and thoroughly confuse the SCSI subsystem.
*
*/
else if (!strncmp("remove-single-device", buffer + 5, 20)) {
} else if (!strncmp("remove-single-device", buffer + 5, 20)) {
p = buffer + 26;
host = simple_strtoul(p, &p, 0);
......@@ -577,39 +547,7 @@ static int proc_scsi_gen_write(struct file * file, const char * buf,
id = simple_strtoul(p + 1, &p, 0);
lun = simple_strtoul(p + 1, &p, 0);
for (shost = scsi_host_get_next(NULL); shost;
shost = scsi_host_get_next(shost)) {
if (shost->host_no == host) {
break;
}
}
err = -ENODEV;
if (!shost)
goto out;
for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
if ((sdev->channel == channel
&& sdev->id == id
&& sdev->lun == lun)) {
break;
}
}
if (sdev == NULL)
goto out; /* there is no such device attached */
err = -EBUSY;
if (sdev->access_count)
goto out;
scsi_detach_device(sdev);
if (sdev->attached == 0) {
devfs_unregister (sdev->de);
scsi_free_sdev(sdev);
err = 0;
}
err = scsi_remove_single_device(host, channel, id, lun);
}
out:
......
This diff is collapsed.
......@@ -68,6 +68,7 @@ EXPORT_SYMBOL(scsi_report_bus_reset);
EXPORT_SYMBOL(scsi_block_requests);
EXPORT_SYMBOL(scsi_unblock_requests);
EXPORT_SYMBOL(scsi_adjust_queue_depth);
EXPORT_SYMBOL(scsi_track_queue_full);
EXPORT_SYMBOL(scsi_get_host_dev);
EXPORT_SYMBOL(scsi_free_host_dev);
......@@ -75,7 +76,6 @@ EXPORT_SYMBOL(scsi_free_host_dev);
EXPORT_SYMBOL(scsi_sleep);
EXPORT_SYMBOL(scsi_io_completion);
EXPORT_SYMBOL(scsi_end_request);
EXPORT_SYMBOL(scsi_register_blocked_host);
EXPORT_SYMBOL(scsi_deregister_blocked_host);
......
......@@ -3673,19 +3673,18 @@ static int st_attach(Scsi_Device * SDp)
buffer = new_tape_buffer(TRUE, (SDp->host)->unchecked_isa_dma, i);
if (buffer == NULL) {
printk(KERN_ERR "st: Can't allocate new tape buffer. Device not attached.\n");
return 1;
goto out_slave_detach;
}
disk = alloc_disk(1);
if (!disk) {
printk(KERN_ERR "st: out of memory. Device not attached.\n");
return 1;
goto out_buffer_free;
}
write_lock(&st_dev_arr_lock);
if (st_nr_dev >= st_dev_max) {
Scsi_Tape **tmp_da;
ST_buffer **tmp_ba;
int tmp_dev_max;
tmp_dev_max = st_nr_dev + ST_DEV_ARR_LUMP;
......@@ -3695,23 +3694,14 @@ static int st_attach(Scsi_Device * SDp)
write_unlock(&st_dev_arr_lock);
printk(KERN_ERR "st: Too many tape devices (max. %d).\n",
ST_MAX_TAPES);
put_disk(disk);
scsi_slave_detach(SDp);
return 1;
goto out_put_disk;
}
tmp_da = kmalloc(tmp_dev_max * sizeof(Scsi_Tape *), GFP_ATOMIC);
tmp_ba = kmalloc(tmp_dev_max * sizeof(ST_buffer *), GFP_ATOMIC);
if (tmp_da == NULL || tmp_ba == NULL) {
if (tmp_da != NULL)
kfree(tmp_da);
if (tmp_ba != NULL)
kfree(tmp_ba);
if (tmp_da == NULL) {
write_unlock(&st_dev_arr_lock);
printk(KERN_ERR "st: Can't extend device array.\n");
put_disk(disk);
scsi_slave_detach(SDp);
return 1;
goto out_put_disk;
}
memset(tmp_da, 0, tmp_dev_max * sizeof(Scsi_Tape *));
......@@ -3735,9 +3725,7 @@ static int st_attach(Scsi_Device * SDp)
if (tpnt == NULL) {
write_unlock(&st_dev_arr_lock);
printk(KERN_ERR "st: Can't allocate device descriptor.\n");
put_disk(disk);
scsi_slave_detach(SDp);
return 1;
goto out_put_disk;
}
memset(tpnt, 0, sizeof(Scsi_Tape));
tpnt->disk = disk;
......@@ -3840,14 +3828,14 @@ static int st_attach(Scsi_Device * SDp)
tpnt->driverfs_dev_r[mode].parent = &SDp->sdev_driverfs_dev;
tpnt->driverfs_dev_r[mode].bus = &scsi_driverfs_bus_type;
tpnt->driverfs_dev_r[mode].driver_data =
(void *)(long)__mkdev(MAJOR_NR, dev_num + (mode << 5));
(void *)(long)__mkdev(SCSI_TAPE_MAJOR, dev_num + (mode << 5));
device_register(&tpnt->driverfs_dev_r[mode]);
device_create_file(&tpnt->driverfs_dev_r[mode],
&dev_attr_type);
device_create_file(&tpnt->driverfs_dev_r[mode], &dev_attr_kdev);
tpnt->de_r[mode] =
devfs_register (SDp->de, name, DEVFS_FL_DEFAULT,
MAJOR_NR, dev_num + (mode << 5),
SCSI_TAPE_MAJOR, dev_num + (mode << 5),
S_IFCHR | S_IRUGO | S_IWUGO,
&st_fops, NULL);
/* No-rewind entry */
......@@ -3859,7 +3847,7 @@ static int st_attach(Scsi_Device * SDp)
tpnt->driverfs_dev_n[mode].parent= &SDp->sdev_driverfs_dev;
tpnt->driverfs_dev_n[mode].bus = &scsi_driverfs_bus_type;
tpnt->driverfs_dev_n[mode].driver_data =
(void *)(long)__mkdev(MAJOR_NR, dev_num + (mode << 5) + 128);
(void *)(long)__mkdev(SCSI_TAPE_MAJOR, dev_num + (mode << 5) + 128);
device_register(&tpnt->driverfs_dev_n[mode]);
device_create_file(&tpnt->driverfs_dev_n[mode],
&dev_attr_type);
......@@ -3867,7 +3855,7 @@ static int st_attach(Scsi_Device * SDp)
&dev_attr_kdev);
tpnt->de_n[mode] =
devfs_register (SDp->de, name, DEVFS_FL_DEFAULT,
MAJOR_NR, dev_num + (mode << 5) + 128,
SCSI_TAPE_MAJOR, dev_num + (mode << 5) + 128,
S_IFCHR | S_IRUGO | S_IWUGO,
&st_fops, NULL);
}
......@@ -3880,6 +3868,14 @@ static int st_attach(Scsi_Device * SDp)
tape_name(tpnt), tpnt->try_dio ? "yes" : "no", tpnt->max_pfn);
return 0;
out_put_disk:
put_disk(disk);
out_buffer_free:
kfree(buffer);
out_slave_detach:
scsi_slave_detach(SDp);
return 1;
};
static void st_detach(Scsi_Device * SDp)
......@@ -3891,20 +3887,15 @@ static void st_detach(Scsi_Device * SDp)
for (i = 0; i < st_dev_max; i++) {
tpnt = scsi_tapes[i];
if (tpnt != NULL && tpnt->device == SDp) {
tpnt->device = NULL;
scsi_tapes[i] = 0;
st_nr_dev--;
write_unlock(&st_dev_arr_lock);
devfs_unregister_tape(tpnt->disk->number);
for (mode = 0; mode < ST_NBR_MODES; ++mode) {
devfs_unregister (tpnt->de_r[mode]);
tpnt->de_r[mode] = NULL;
devfs_unregister (tpnt->de_n[mode]);
tpnt->de_n[mode] = NULL;
}
devfs_unregister_tape(tpnt->disk->number);
scsi_tapes[i] = 0;
scsi_slave_detach(SDp);
st_nr_dev--;
write_unlock(&st_dev_arr_lock);
for (mode = 0; mode < ST_NBR_MODES; ++mode) {
device_remove_file(&tpnt->driverfs_dev_r[mode],
&dev_attr_type);
device_remove_file(&tpnt->driverfs_dev_r[mode],
......@@ -3916,11 +3907,14 @@ static void st_detach(Scsi_Device * SDp)
&dev_attr_kdev);
device_unregister(&tpnt->driverfs_dev_n[mode]);
}
tpnt->device = NULL;
if (tpnt->buffer) {
tpnt->buffer->orig_frp_segs = 0;
normalize_buffer(tpnt->buffer);
kfree(tpnt->buffer);
}
scsi_slave_detach(SDp);
put_disk(tpnt->disk);
kfree(tpnt);
return;
......@@ -3944,9 +3938,10 @@ static int __init init_st(void)
if (register_chrdev(SCSI_TAPE_MAJOR, "st", &st_fops) >= 0) {
if (scsi_register_device(&st_template) == 0)
return 0;
unregister_chrdev(SCSI_TAPE_MAJOR, "st");
}
printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", MAJOR_NR);
printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", SCSI_TAPE_MAJOR);
return 1;
}
......@@ -3959,8 +3954,9 @@ static void __exit exit_st(void)
if (scsi_tapes != NULL) {
for (i=0; i < st_dev_max; ++i)
if (scsi_tapes[i]) {
put_disk(scsi_tapes[i]->disk);
kfree(scsi_tapes[i]);
printk(KERN_WARNING "st: scsi_tapes[] not "
"empty after scsi_unregister_device\n");
st_detach(scsi_tapes[i]->device);
}
kfree(scsi_tapes);
}
......
......@@ -13525,7 +13525,7 @@ static int device_queue_depth(ncb_p np, int target, int lun)
return DEF_DEPTH;
}
int sym53c8xx_slave_attach(Scsi_Device *device)
int sym53c8xx_slave_configure(Scsi_Device *device)
{
struct Scsi_Host *host = device->host;
ncb_p np;
......
......@@ -74,7 +74,7 @@ int sym53c8xx_detect(Scsi_Host_Template *tpnt);
const char *sym53c8xx_info(struct Scsi_Host *host);
int sym53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int sym53c8xx_reset(Scsi_Cmnd *, unsigned int);
int sym53c8xx_slave_attach(Scsi_Device *);
int sym53c8xx_slave_configure(Scsi_Device *);
#ifdef MODULE
int sym53c8xx_release(struct Scsi_Host *);
......@@ -90,7 +90,7 @@ int sym53c8xx_release(struct Scsi_Host *);
release: sym53c8xx_release, \
info: sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command,\
slave_attach: sym53c8xx_slave_attach, \
slave_configure:sym53c8xx_slave_configure,\
abort: sym53c8xx_abort, \
reset: sym53c8xx_reset, \
can_queue: SCSI_NCR_CAN_QUEUE, \
......
......@@ -89,7 +89,7 @@ int sym53c8xx_eh_device_reset_handler(Scsi_Cmnd *);
int sym53c8xx_eh_bus_reset_handler(Scsi_Cmnd *);
int sym53c8xx_eh_host_reset_handler(Scsi_Cmnd *);
int sym53c8xx_slave_attach(Scsi_Device *);
int sym53c8xx_slave_configure(Scsi_Device *);
#ifdef MODULE
int sym53c8xx_release(struct Scsi_Host *);
......@@ -111,7 +111,7 @@ int sym53c8xx_release(struct Scsi_Host *);
release: sym53c8xx_release, \
info: sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command, \
slave_attach: sym53c8xx_slave_attach, \
slave_configure: sym53c8xx_slave_configure, \
eh_abort_handler: sym53c8xx_eh_abort_handler, \
eh_device_reset_handler:sym53c8xx_eh_device_reset_handler, \
eh_bus_reset_handler: sym53c8xx_eh_bus_reset_handler, \
......
......@@ -1328,7 +1328,7 @@ static int device_queue_depth(hcb_p np, int target, int lun)
* Linux entry point for device queue sizing.
*/
int
sym53c8xx_slave_attach(Scsi_Device *device)
sym53c8xx_slave_configure(Scsi_Device *device)
{
struct Scsi_Host *host = device->host;
hcb_p np;
......
......@@ -630,7 +630,7 @@ static int max_queue_depth = CONFIG_SCSI_U14_34F_MAX_TAGS;
static int max_queue_depth = MAX_CMD_PER_LUN;
#endif
static int u14_34f_slave_attach(Scsi_Device *dev) {
static int u14_34f_slave_configure(Scsi_Device *dev) {
int j, tqd, utqd;
char *tag_suffix, *link_suffix;
struct Scsi_Host *host = dev->host;
......
......@@ -8,7 +8,7 @@ static int u14_34f_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
static int u14_34f_eh_abort(Scsi_Cmnd *);
static int u14_34f_eh_host_reset(Scsi_Cmnd *);
static int u14_34f_bios_param(struct scsi_device *, struct block_device *, sector_t, int *);
static int u14_34f_slave_attach(Scsi_Device *);
static int u14_34f_slave_configure(Scsi_Device *);
#define U14_34F_VERSION "8.00.00"
......@@ -22,7 +22,7 @@ static int u14_34f_slave_attach(Scsi_Device *);
eh_bus_reset_handler: NULL, \
eh_host_reset_handler: u14_34f_eh_host_reset, \
bios_param: u14_34f_bios_param, \
slave_attach: u14_34f_slave_attach, \
slave_configure: u14_34f_slave_configure, \
this_id: 7, \
unchecked_isa_dma: 1, \
use_clustering: ENABLE_CLUSTERING \
......
......@@ -1434,23 +1434,21 @@ static int wd7000_proc_info(char *buffer, char **start, off_t offset, int length
/*
* Display driver information for each device attached to the board.
*/
scd = host->host_queue;
SPRINTF("\nAttached devices: %s\n", !list_empty(&host->my_devices) ?
"" : "none");
SPRINTF("\nAttached devices: %s\n", scd ? "" : "none");
list_for_each_entry (scd, &host->my_devices, siblings) {
SPRINTF(" [Channel: %02d, Id: %02d, Lun: %02d] ", scd->channel, scd->id, scd->lun);
SPRINTF("%s ", (scd->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(short) scd->type] : "Unknown device");
for (; scd; scd = scd->next)
if (scd->host->host_no == hostno) {
SPRINTF(" [Channel: %02d, Id: %02d, Lun: %02d] ", scd->channel, scd->id, scd->lun);
SPRINTF("%s ", (scd->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(short) scd->type] : "Unknown device");
for (i = 0; (i < 8) && (scd->vendor[i] >= 0x20); i++)
SPRINTF("%c", scd->vendor[i]);
SPRINTF(" ");
for (i = 0; (i < 8) && (scd->vendor[i] >= 0x20); i++)
SPRINTF("%c", scd->vendor[i]);
SPRINTF(" ");
for (i = 0; (i < 16) && (scd->model[i] >= 0x20); i++)
SPRINTF("%c", scd->model[i]);
SPRINTF("\n");
}
for (i = 0; (i < 16) && (scd->model[i] >= 0x20); i++)
SPRINTF("%c", scd->model[i]);
SPRINTF("\n");
}
SPRINTF("\n");
......
......@@ -73,7 +73,7 @@ static void proc_delete_inode(struct inode *inode)
de = PROC_I(inode)->pde;
if (de) {
if (de->owner)
__MOD_DEC_USE_COUNT(de->owner);
module_put(de->owner);
de_put(de);
}
}
......@@ -200,8 +200,8 @@ printk("proc_iget: using deleted entry %s, count=%d\n", de->name, atomic_read(&d
inode->i_size = de->size;
if (de->nlink)
inode->i_nlink = de->nlink;
if (de->owner)
__MOD_INC_USE_COUNT(de->owner);
if (!try_module_get(de->owner))
goto out_fail;
if (de->proc_iops)
inode->i_op = de->proc_iops;
if (de->proc_fops)
......
......@@ -595,7 +595,8 @@ static int __init rd_load_image(char *from)
#ifdef CONFIG_BLK_DEV_RAM
int in_fd, out_fd;
int nblocks, rd_blocks, devblocks, i;
unsigned long rd_blocks, devblocks;
int nblocks, i;
char *buf;
unsigned short rotate = 0;
#if !defined(CONFIG_ARCH_S390) && !defined(CONFIG_PPC_ISERIES)
......
......@@ -961,13 +961,20 @@ asmlinkage long sys_swapoff(const char * specialfile)
unsigned short *swap_map;
struct file *swap_file, *victim;
struct address_space *mapping;
char * pathname;
int i, type, prev;
int err;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
victim = filp_open(specialfile, O_RDWR, 0);
pathname = getname(specialfile);
err = PTR_ERR(pathname);
if (IS_ERR(pathname))
goto out;
victim = filp_open(pathname, O_RDWR, 0);
putname(pathname);
err = PTR_ERR(victim);
if (IS_ERR(victim))
goto out;
......
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