Commit 8e221e3d authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by James Bottomley

[PATCH] NCR53C9x slave_{alloc,destroy}()

NCR53C9x: Add missing slave_{alloc,destroy}() (from Kars de Jong and Matthias
Urlichs). This affects the following drivers:
  - Amiga Blizzard 1230, Blizzard 2060, CyberStorm, CyberStorm Mk II, Fastlane,
    and Oktagon SCSI
  - DECstation NCR53C94 SCSI
  - Jazz ESP 100/100a/200 SCSI
  - Mac 53C9x SCSI
  - MCA NCR 53c9x SCSI
  - Sun-3x SCSI (was already fixed on its own)
parent fb81a906
......@@ -3615,6 +3615,27 @@ irqreturn_t esp_intr(int irq, void *dev_id, struct pt_regs *pregs)
}
#endif
int esp_slave_alloc(Scsi_Device *SDptr)
{
struct esp_device *esp_dev =
kmalloc(sizeof(struct esp_device), GFP_ATOMIC);
if (!esp_dev)
return -ENOMEM;
memset(esp_dev, 0, sizeof(struct esp_device));
SDptr->hostdata = esp_dev;
return 0;
}
void esp_slave_destroy(Scsi_Device *SDptr)
{
struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata;
esp->targets_present &= ~(1 << SDptr->id);
kfree(SDptr->hostdata);
SDptr->hostdata = NULL;
}
#ifdef MODULE
int init_module(void) { return 0; }
void cleanup_module(void) {}
......
......@@ -665,4 +665,6 @@ extern int esp_abort(Scsi_Cmnd *);
extern int esp_reset(Scsi_Cmnd *);
extern int esp_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length,
int inout);
extern int esp_slave_alloc(Scsi_Device *);
extern void esp_slave_destroy(Scsi_Device *);
#endif /* !(NCR53C9X_H) */
......@@ -333,6 +333,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = esp_proc_info,
.name = "Blizzard1230 SCSI IV",
.detect = blz1230_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = blz1230_esp_release,
.queuecommand = esp_queue,
.eh_abort_handler = esp_abort,
......
......@@ -287,6 +287,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = esp_proc_info,
.name = "Blizzard2060 SCSI",
.detect = blz2060_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = blz2060_esp_release,
.queuecommand = esp_queue,
.eh_abort_handler = esp_abort,
......
......@@ -358,6 +358,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = esp_proc_info,
.name = "CyberStorm SCSI",
.detect = cyber_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = cyber_esp_release,
.queuecommand = esp_queue,
.eh_abort_handler = esp_abort,
......
......@@ -295,6 +295,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = esp_proc_info,
.name = "CyberStorm Mk II SCSI",
.detect = cyberII_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = cyberII_esp_release,
.queuecommand = esp_queue,
.eh_abort_handler = esp_abort,
......
......@@ -124,6 +124,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = &esp_proc_info,
.name = "NCR53C94",
.detect = dec_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = dec_esp_release,
.info = esp_info,
.queuecommand = esp_queue,
......
......@@ -404,6 +404,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = esp_proc_info,
.name = "Fastlane SCSI",
.detect = fastlane_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = fastlane_esp_release,
.queuecommand = esp_queue,
.eh_abort_handler = esp_abort,
......
......@@ -290,6 +290,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = &esp_proc_info,
.name = "ESP 100/100a/200",
.detect = jazz_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = jazz_esp_release,
.info = esp_info,
.queuecommand = esp_queue,
......
......@@ -734,6 +734,8 @@ static Scsi_Host_Template driver_template = {
.proc_name = "esp",
.name = "Mac 53C9x SCSI",
.detect = mac_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = mac_esp_release,
.info = esp_info,
.queuecommand = esp_queue,
......
......@@ -448,6 +448,8 @@ static Scsi_Host_Template driver_template = {
.proc_name = "esp",
.name = "NCR 53c9x SCSI",
.detect = mca_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = mca_esp_release,
.queuecommand = esp_queue,
.eh_abort_handler = esp_abort,
......
......@@ -595,6 +595,8 @@ static Scsi_Host_Template driver_template = {
.proc_info = &esp_proc_info,
.name = "BSC Oktagon SCSI",
.detect = oktagon_esp_detect,
.slave_alloc = esp_slave_alloc,
.slave_destroy = esp_slave_destroy,
.release = oktagon_esp_release,
.queuecommand = esp_queue,
.eh_abort_handler = esp_abort,
......
......@@ -374,29 +374,6 @@ static void dma_advance_sg (Scsi_Cmnd *sp)
sp->SCp.ptr = (char *)((unsigned long)sp->SCp.buffer->dvma_address);
}
static int esp_slave_alloc(Scsi_Device *SDptr)
{
struct esp_device *esp_dev =
kmalloc(sizeof(struct esp_device), GFP_ATOMIC);
if (!esp_dev)
return -ENOMEM;
memset(esp_dev, 0, sizeof(struct esp_device));
SDptr->hostdata = esp_dev;
return 0;
}
static void esp_slave_destroy(Scsi_Device *SDptr)
{
struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata;
esp->targets_present &= ~(1 << SDptr->id);
kfree(SDptr->hostdata);
SDptr->hostdata = NULL;
}
static int sun3x_esp_release(struct Scsi_Host *instance)
{
/* this code does not support being compiled as a module */
......
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