[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual MPL/GPL");
|
||||
/*====================================================================*/
|
||||
|
||||
typedef struct scsi_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
struct Scsi_Host *host;
|
||||
} scsi_info_t;
|
||||
@@ -103,7 +103,7 @@ static dev_link_t *dev_list;
|
||||
static int aha152x_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
scsi_info_t *info;
|
||||
dev_link_t *link;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "aha152x_attach()\n");
|
||||
|
||||
@@ -111,7 +111,8 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
|
||||
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info) return -ENOMEM;
|
||||
memset(info, 0, sizeof(*info));
|
||||
link = &info->link; link->priv = info;
|
||||
info->p_dev = p_dev;
|
||||
link->priv = info;
|
||||
|
||||
link->io.NumPorts1 = 0x20;
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
|
||||
@@ -122,9 +123,6 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
aha152x_config_cs(link);
|
||||
|
||||
@@ -136,23 +134,14 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
|
||||
static void aha152x_detach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
dev_link_t **linkp;
|
||||
|
||||
DEBUG(0, "aha152x_detach(0x%p)\n", link);
|
||||
|
||||
/* Locate device structure */
|
||||
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
|
||||
if (*linkp == link) break;
|
||||
if (*linkp == NULL)
|
||||
return;
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
aha152x_release_cs(link);
|
||||
|
||||
/* Unlink device structure, free bits */
|
||||
*linkp = link->next;
|
||||
kfree(link->priv);
|
||||
|
||||
} /* aha152x_detach */
|
||||
|
||||
/*====================================================================*/
|
||||
@@ -230,7 +219,7 @@ static void aha152x_config_cs(dev_link_t *link)
|
||||
}
|
||||
|
||||
sprintf(info->node.dev_name, "scsi%d", host->host_no);
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
info->host = host;
|
||||
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
|
||||
@@ -73,7 +73,7 @@ static char *version =
|
||||
/*====================================================================*/
|
||||
|
||||
typedef struct scsi_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
struct Scsi_Host *host;
|
||||
} scsi_info_t;
|
||||
@@ -86,7 +86,7 @@ static void fdomain_config(dev_link_t *link);
|
||||
static int fdomain_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
scsi_info_t *info;
|
||||
dev_link_t *link;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "fdomain_attach()\n");
|
||||
|
||||
@@ -94,7 +94,8 @@ static int fdomain_attach(struct pcmcia_device *p_dev)
|
||||
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info) return -ENOMEM;
|
||||
memset(info, 0, sizeof(*info));
|
||||
link = &info->link; link->priv = info;
|
||||
info->p_dev = p_dev;
|
||||
link->priv = info;
|
||||
link->io.NumPorts1 = 0x10;
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
|
||||
link->io.IOAddrLines = 10;
|
||||
@@ -104,9 +105,6 @@ static int fdomain_attach(struct pcmcia_device *p_dev)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
fdomain_config(link);
|
||||
|
||||
@@ -191,7 +189,7 @@ static void fdomain_config(dev_link_t *link)
|
||||
scsi_scan_host(host);
|
||||
|
||||
sprintf(info->node.dev_name, "scsi%d", host->host_no);
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
info->host = host;
|
||||
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
|
||||
@@ -1596,8 +1596,8 @@ static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt)
|
||||
static int nsp_cs_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
scsi_info_t *info;
|
||||
dev_link_t *link;
|
||||
nsp_hw_data *data = &nsp_data_base;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
nsp_dbg(NSP_DEBUG_INIT, "in");
|
||||
|
||||
@@ -1605,7 +1605,7 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev)
|
||||
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (info == NULL) { return -ENOMEM; }
|
||||
memset(info, 0, sizeof(*info));
|
||||
link = &info->link;
|
||||
info->p_dev = p_dev;
|
||||
link->priv = info;
|
||||
data->ScsiInfo = info;
|
||||
|
||||
@@ -1630,9 +1630,6 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
nsp_cs_config(link);
|
||||
|
||||
@@ -1853,12 +1850,12 @@ static void nsp_cs_config(dev_link_t *link)
|
||||
scsi_scan_host(host);
|
||||
|
||||
snprintf(info->node.dev_name, sizeof(info->node.dev_name), "scsi%d", host->host_no);
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
info->host = host;
|
||||
|
||||
#else
|
||||
nsp_dbg(NSP_DEBUG_INIT, "GET_SCSI_INFO");
|
||||
tail = &link->dev;
|
||||
tail = &link->dev_node;
|
||||
info->ndev = 0;
|
||||
|
||||
nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host);
|
||||
@@ -1962,7 +1959,7 @@ static void nsp_cs_release(dev_link_t *link)
|
||||
#else
|
||||
scsi_unregister_host(&nsp_driver_template);
|
||||
#endif
|
||||
link->dev = NULL;
|
||||
link->dev_node = NULL;
|
||||
|
||||
if (link->win) {
|
||||
if (data != NULL) {
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
/*====================================================================*/
|
||||
|
||||
typedef struct scsi_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
struct Scsi_Host *host;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74))
|
||||
dev_node_t node;
|
||||
|
||||
@@ -91,7 +91,7 @@ static struct scsi_host_template qlogicfas_driver_template = {
|
||||
/*====================================================================*/
|
||||
|
||||
typedef struct scsi_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
struct Scsi_Host *host;
|
||||
unsigned short manf_id;
|
||||
@@ -159,7 +159,7 @@ err:
|
||||
static int qlogic_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
scsi_info_t *info;
|
||||
dev_link_t *link;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "qlogic_attach()\n");
|
||||
|
||||
@@ -168,7 +168,7 @@ static int qlogic_attach(struct pcmcia_device *p_dev)
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
memset(info, 0, sizeof(*info));
|
||||
link = &info->link;
|
||||
info->p_dev = p_dev;
|
||||
link->priv = info;
|
||||
link->io.NumPorts1 = 16;
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
|
||||
@@ -179,9 +179,6 @@ static int qlogic_attach(struct pcmcia_device *p_dev)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
qlogic_config(link);
|
||||
|
||||
@@ -278,7 +275,7 @@ static void qlogic_config(dev_link_t * link)
|
||||
}
|
||||
|
||||
sprintf(info->node.dev_name, "scsi%d", host->host_no);
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
info->host = host;
|
||||
|
||||
out:
|
||||
|
||||
@@ -202,7 +202,7 @@ static char *version =
|
||||
/* ================================================================== */
|
||||
|
||||
struct scsi_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
struct Scsi_Host *host;
|
||||
unsigned short manf_id;
|
||||
@@ -829,7 +829,7 @@ next_entry:
|
||||
data->fast_pio = USE_FAST_PIO;
|
||||
|
||||
sprintf(info->node.dev_name, "scsi%d", host->host_no);
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
info->host = host;
|
||||
|
||||
if (scsi_add_host(host, NULL))
|
||||
@@ -899,7 +899,7 @@ static int
|
||||
SYM53C500_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct scsi_info_t *info;
|
||||
dev_link_t *link;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "SYM53C500_attach()\n");
|
||||
|
||||
@@ -908,7 +908,7 @@ SYM53C500_attach(struct pcmcia_device *p_dev)
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
memset(info, 0, sizeof(*info));
|
||||
link = &info->link;
|
||||
info->p_dev = p_dev;
|
||||
link->priv = info;
|
||||
link->io.NumPorts1 = 16;
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
|
||||
@@ -919,9 +919,6 @@ SYM53C500_attach(struct pcmcia_device *p_dev)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
SYM53C500_config(link);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user