[RFC PATCH 11/11] pcmcia updates (post 2.6.16): embed dev_link_t
into struct pcmcia_device
Dominik Brodowski
linux at dominikbrodowski.net
Sun Jan 15 14:16:44 EST 2006
Subject: [PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
From: Dominik Brodowski <linux at dominikbrodowski.net>
Date: 1137351427 +0100
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.
Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
---
drivers/bluetooth/bluecard_cs.c | 31 ++++------
drivers/bluetooth/bt3c_cs.c | 21 +++----
drivers/bluetooth/btuart_cs.c | 25 +++-----
drivers/bluetooth/dtl1_cs.c | 25 +++-----
drivers/char/pcmcia/cm4000_cs.c | 29 ++++-----
drivers/char/pcmcia/cm4040_cs.c | 29 ++++-----
drivers/char/pcmcia/synclink_cs.c | 21 +++----
drivers/ide/legacy/ide-cs.c | 13 ++--
drivers/isdn/hardware/avm/avm_cs.c | 45 +++++---------
drivers/isdn/hisax/avma1_cs.c | 48 ++++++---------
drivers/isdn/hisax/elsa_cs.c | 14 ++--
drivers/isdn/hisax/sedlbauer_cs.c | 16 ++---
drivers/isdn/hisax/teles_cs.c | 13 ++--
drivers/mtd/maps/pcmciamtd.c | 22 +++----
drivers/net/pcmcia/3c574_cs.c | 19 +++---
drivers/net/pcmcia/3c589_cs.c | 23 +++----
drivers/net/pcmcia/axnet_cs.c | 19 +++---
drivers/net/pcmcia/com20020_cs.c | 39 +++++-------
drivers/net/pcmcia/fmvj18x_cs.c | 19 +++---
drivers/net/pcmcia/ibmtr_cs.c | 17 ++---
drivers/net/pcmcia/nmclan_cs.c | 21 +++----
drivers/net/pcmcia/pcnet_cs.c | 21 +++----
drivers/net/pcmcia/smc91c92_cs.c | 19 +++---
drivers/net/pcmcia/xirc2ps_cs.c | 19 +++---
drivers/net/wireless/airo_cs.c | 33 +++-------
drivers/net/wireless/atmel_cs.c | 33 +++-------
drivers/net/wireless/hostap/hostap_cs.c | 20 +-----
drivers/net/wireless/netwave_cs.c | 19 +++---
drivers/net/wireless/orinoco_cs.c | 22 +++----
drivers/net/wireless/ray_cs.c | 98 ++++++++++---------------------
drivers/net/wireless/spectrum_cs.c | 21 +++----
drivers/net/wireless/wavelan_cs.c | 46 +++++----------
drivers/net/wireless/wl3501.h | 1
drivers/net/wireless/wl3501_cs.c | 61 +++----------------
drivers/parport/parport_cs.c | 12 ++--
drivers/pcmcia/ds.c | 19 +++---
drivers/pcmcia/pcmcia_ioctl.c | 9 +--
drivers/pcmcia/pcmcia_resource.c | 13 ++--
drivers/scsi/pcmcia/aha152x_stub.c | 21 ++-----
drivers/scsi/pcmcia/fdomain_stub.c | 12 ++--
drivers/scsi/pcmcia/nsp_cs.c | 13 ++--
drivers/scsi/pcmcia/nsp_cs.h | 2 -
drivers/scsi/pcmcia/qlogic_stub.c | 11 +--
drivers/scsi/pcmcia/sym53c500_cs.c | 11 +--
drivers/serial/serial_cs.c | 16 ++---
drivers/telephony/ixj_pcmcia.c | 31 +++-------
drivers/usb/host/sl811_cs.c | 11 +--
include/pcmcia/ds.h | 31 ++++------
sound/pcmcia/pdaudiocf/pdaudiocf.c | 12 ++--
sound/pcmcia/pdaudiocf/pdaudiocf.h | 2 -
sound/pcmcia/vx/vxpocket.c | 20 +++---
sound/pcmcia/vx/vxpocket.h | 2 -
52 files changed, 445 insertions(+), 725 deletions(-)
Full patch at:
http://kernel.org/git/?p=linux/kernel/git/brodo/pcmcia-2.6.git;a=commit;h=4ed43d6725c050ddd534f929e5ffa487592b7175
920819f0a2c7f22023f79c0378922d4445b29898
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 8e23f9a..b461411 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -65,7 +65,7 @@ MODULE_LICENSE("GPL");
typedef struct bluecard_info_t {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
struct hci_dev *hdev;
@@ -162,7 +162,7 @@ static void bluecard_detach(struct pcmci
static void bluecard_activity_led_timeout(u_long arg)
{
bluecard_info_t *info = (bluecard_info_t *)arg;
- unsigned int iobase = info->link.io.BasePort1;
+ unsigned int iobase = info->p_dev->io.BasePort1;
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
return;
@@ -179,7 +179,7 @@ static void bluecard_activity_led_timeou
static void bluecard_enable_activity_led(bluecard_info_t *info)
{
- unsigned int iobase = info->link.io.BasePort1;
+ unsigned int iobase = info->p_dev->io.BasePort1;
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
return;
@@ -235,7 +235,7 @@ static void bluecard_write_wakeup(blueca
}
do {
- register unsigned int iobase = info->link.io.BasePort1;
+ register unsigned int iobase = info->p_dev->io.BasePort1;
register unsigned int offset;
register unsigned char command;
register unsigned long ready_bit;
@@ -244,7 +244,7 @@ static void bluecard_write_wakeup(blueca
clear_bit(XMIT_WAKEUP, &(info->tx_state));
- if (!(info->link.state & DEV_PRESENT))
+ if (!(info->p_dev->state & DEV_PRESENT))
return;
if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) {
@@ -382,7 +382,7 @@ static void bluecard_receive(bluecard_in
return;
}
- iobase = info->link.io.BasePort1;
+ iobase = info->p_dev->io.BasePort1;
if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
bluecard_enable_activity_led(info);
@@ -512,7 +512,7 @@ static irqreturn_t bluecard_interrupt(in
if (!test_bit(CARD_READY, &(info->hw_state)))
return IRQ_HANDLED;
- iobase = info->link.io.BasePort1;
+ iobase = info->p_dev->io.BasePort1;
spin_lock(&(info->lock));
@@ -626,7 +626,7 @@ static int bluecard_hci_flush(struct hci
static int bluecard_hci_open(struct hci_dev *hdev)
{
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
- unsigned int iobase = info->link.io.BasePort1;
+ unsigned int iobase = info->p_dev->io.BasePort1;
if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
@@ -646,7 +646,7 @@ static int bluecard_hci_open(struct hci_
static int bluecard_hci_close(struct hci_dev *hdev)
{
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
- unsigned int iobase = info->link.io.BasePort1;
+ unsigned int iobase = info->p_dev->io.BasePort1;
if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
return 0;
@@ -713,7 +713,7 @@ static int bluecard_hci_ioctl(struct hci
static int bluecard_open(bluecard_info_t *info)
{
- unsigned int iobase = info->link.io.BasePort1;
+ unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev;
unsigned char id;
@@ -831,7 +831,7 @@ static int bluecard_open(bluecard_info_t
static int bluecard_close(bluecard_info_t *info)
{
- unsigned int iobase = info->link.io.BasePort1;
+ unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev = info->hdev;
if (!hdev)
@@ -859,14 +859,14 @@ static int bluecard_close(bluecard_info_
static int bluecard_attach(struct pcmcia_device *p_dev)
{
bluecard_info_t *info;
- dev_link_t *link;
+ dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
- link = &info->link;
+ info->p_dev = p_dev;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -880,9 +880,6 @@ static int bluecard_attach(struct pcmcia
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
bluecard_config(link);
@@ -976,7 +973,7 @@ static void bluecard_config(dev_link_t *
goto failed;
strcpy(info->node.dev_name, info->hdev->name);
- link->dev = &info->node;
+ link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return;
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 28466cf..44dc883 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -382,6 +382,7 @@ static int pcmcia_device_probe(struct de
}
p_dev->p_state &= ~CLIENT_UNBOUND;
+ p_dev->handle = p_dev;
ret = p_drv->probe(p_dev);
@@ -1034,12 +1035,10 @@ static int pcmcia_dev_suspend(struct dev
ret = p_drv->suspend(p_dev);
if (ret)
return ret;
- if (p_dev->instance) {
- p_dev->instance->state |= DEV_SUSPEND;
- if ((p_dev->instance->state & DEV_CONFIG) &&
- !(p_dev->instance->state & DEV_SUSPEND_NORELEASE))
+ p_dev->state |= DEV_SUSPEND;
+ if ((p_dev->state & DEV_CONFIG) &&
+ !(p_dev->state & DEV_SUSPEND_NORELEASE))
pcmcia_release_configuration(p_dev);
- }
}
return 0;
@@ -1056,16 +1055,14 @@ static int pcmcia_dev_resume(struct devi
p_drv = to_pcmcia_drv(dev->driver);
if (p_drv && p_drv->resume) {
- if (p_dev->instance) {
- p_dev->instance->state &= ~DEV_SUSPEND;
- if ((p_dev->instance->state & DEV_CONFIG) &&
- !(p_dev->instance->state & DEV_SUSPEND_NORELEASE)){
+ p_dev->state &= ~DEV_SUSPEND;
+ if ((p_dev->state & DEV_CONFIG) &&
+ !(p_dev->state & DEV_SUSPEND_NORELEASE)){
ret = pcmcia_request_configuration(p_dev,
- &p_dev->instance->conf);
+ &p_dev->conf);
if (ret)
return ret;
}
- }
return p_drv->resume(p_dev);
}
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index be08bc9..2b11a33 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -229,7 +229,7 @@ static int bind_request(struct pcmcia_so
* by userspace before, we need to
* return the "instance". */
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
- bind_info->instance = p_dev->instance;
+ bind_info->instance = p_dev;
ret = -EBUSY;
goto err_put_module;
} else {
@@ -358,16 +358,15 @@ static int get_device_info(struct pcmcia
found:
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
- if ((!p_dev->instance) ||
- (p_dev->instance->state & DEV_CONFIG_PENDING)) {
+ if (p_dev->state & DEV_CONFIG_PENDING) {
ret = -EAGAIN;
goto err_put;
}
if (first)
- node = p_dev->instance->dev;
+ node = p_dev->dev_node;
else
- for (node = p_dev->instance->dev; node; node = node->next)
+ for (node = p_dev->dev_node; node; node = node->next)
if (node == bind_info->next)
break;
if (!node) {
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index ab0bbb6..93ab940 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -942,15 +942,12 @@ int pcmcia_request_window(struct pcmcia_
EXPORT_SYMBOL(pcmcia_request_window);
void pcmcia_disable_device(struct pcmcia_device *p_dev) {
- if (!p_dev->instance)
- return;
-
pcmcia_release_configuration(p_dev);
- pcmcia_release_io(p_dev, &p_dev->instance->io);
- pcmcia_release_irq(p_dev, &p_dev->instance->irq);
- if (&p_dev->instance->win)
- pcmcia_release_window(p_dev->instance->win);
+ pcmcia_release_io(p_dev, &p_dev->io);
+ pcmcia_release_irq(p_dev, &p_dev->irq);
+ if (&p_dev->win)
+ pcmcia_release_window(p_dev->win);
- p_dev->instance->dev = NULL;
+ p_dev->dev_node = NULL;
}
EXPORT_SYMBOL(pcmcia_disable_device);
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 7f712df..61f7d2d 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -39,7 +39,7 @@ typedef struct win_info_t {
typedef struct bind_info_t {
dev_info_t dev_info;
u_char function;
- struct dev_link_t *instance;
+ struct pcmcia_device *instance;
char name[DEV_NAME_LEN];
u_short major, minor;
void *next;
@@ -103,18 +103,6 @@ typedef struct dev_node_t {
struct dev_node_t *next;
} dev_node_t;
-typedef struct dev_link_t {
- dev_node_t *dev;
- u_int state, open;
- client_handle_t handle;
- io_req_t io;
- irq_req_t irq;
- config_req_t conf;
- window_handle_t win;
- void *priv;
- struct dev_link_t *next;
-} dev_link_t;
-
/* Flags for device state */
#define DEV_PRESENT 0x01
#define DEV_CONFIG 0x02
@@ -163,9 +151,17 @@ struct pcmcia_device {
struct list_head socket_device_list;
- /* deprecated, a cleaned up version will be moved into this
- struct soon */
- dev_link_t *instance;
+ /* deprecated, will be cleaned up soon */
+ dev_node_t *dev_node;
+ u_int state;
+ u_int open;
+ struct pcmcia_device *handle;
+ io_req_t io;
+ irq_req_t irq;
+ config_req_t conf;
+ window_handle_t win;
+ void *priv;
+
u_int p_state;
/* information about this device */
@@ -189,6 +185,7 @@ struct pcmcia_device {
struct pcmcia_driver * cardmgr;
#endif
};
+typedef struct pcmcia_device dev_link_t;
#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
@@ -196,7 +193,7 @@ struct pcmcia_device {
#define handle_to_pdev(handle) (handle)
#define handle_to_dev(handle) (handle->dev)
-#define dev_to_instance(dev) (dev->instance)
+#define dev_to_instance(dev) (dev)
/* error reporting */
void cs_error(client_handle_t handle, int func, int ret);
--
1.1.2
More information about the linux-pcmcia
mailing list