mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-20 15:06:39 +07:00
pcmcia: dev_node removal (remaining drivers)
As a fourth step, remove any remaining usages of dev_node_t from drivers: - ipwireless can be simplified a bit, as we do not need to pass around the (write-only) dev_node_t around. - avma1_cs can be simplified as well, if we only keep the minor number around as "priv" data, not a full-fledged struct. Acked-by: Jiri Kosina <jkosina@suse.cz> Acked-by: Karsten Keil <isdn@linux-pingi.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
c7c2fa0790
commit
b498ada6d0
@ -228,8 +228,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
|
|||||||
if (!ipw->network)
|
if (!ipw->network)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
ipw->tty = ipwireless_tty_create(ipw->hardware, ipw->network,
|
ipw->tty = ipwireless_tty_create(ipw->hardware, ipw->network);
|
||||||
ipw->nodes);
|
|
||||||
if (!ipw->tty)
|
if (!ipw->tty)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
@ -244,8 +243,6 @@ static int config_ipwireless(struct ipw_dev *ipw)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
link->dev_node = &ipw->nodes[0];
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@ -306,9 +303,6 @@ static int ipwireless_attach(struct pcmcia_device *link)
|
|||||||
ipw->link = link;
|
ipw->link = link;
|
||||||
link->priv = ipw;
|
link->priv = ipw;
|
||||||
|
|
||||||
/* Link this device into our device list. */
|
|
||||||
link->dev_node = &ipw->nodes[0];
|
|
||||||
|
|
||||||
ipw->hardware = ipwireless_hardware_create();
|
ipw->hardware = ipwireless_hardware_create();
|
||||||
if (!ipw->hardware) {
|
if (!ipw->hardware) {
|
||||||
kfree(ipw);
|
kfree(ipw);
|
||||||
|
@ -54,7 +54,6 @@ struct ipw_dev {
|
|||||||
void __iomem *common_memory;
|
void __iomem *common_memory;
|
||||||
win_req_t request_common_memory;
|
win_req_t request_common_memory;
|
||||||
|
|
||||||
dev_node_t nodes[2];
|
|
||||||
/* Reference to attribute memory, containing CIS data */
|
/* Reference to attribute memory, containing CIS data */
|
||||||
void *attribute_memory;
|
void *attribute_memory;
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
|
|||||||
return tty_mode_ioctl(linux_tty, file, cmd , arg);
|
return tty_mode_ioctl(linux_tty, file, cmd , arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_tty(dev_node_t *nodesp, int j,
|
static int add_tty(int j,
|
||||||
struct ipw_hardware *hardware,
|
struct ipw_hardware *hardware,
|
||||||
struct ipw_network *network, int channel_idx,
|
struct ipw_network *network, int channel_idx,
|
||||||
int secondary_channel_idx, int tty_type)
|
int secondary_channel_idx, int tty_type)
|
||||||
@ -510,19 +510,13 @@ static int add_tty(dev_node_t *nodesp, int j,
|
|||||||
ipwireless_associate_network_tty(network,
|
ipwireless_associate_network_tty(network,
|
||||||
secondary_channel_idx,
|
secondary_channel_idx,
|
||||||
ttys[j]);
|
ttys[j]);
|
||||||
if (nodesp != NULL) {
|
|
||||||
sprintf(nodesp->dev_name, "ttyIPWp%d", j);
|
|
||||||
nodesp->major = ipw_tty_driver->major;
|
|
||||||
nodesp->minor = j + ipw_tty_driver->minor_start;
|
|
||||||
}
|
|
||||||
if (get_tty(j + ipw_tty_driver->minor_start) == ttys[j])
|
if (get_tty(j + ipw_tty_driver->minor_start) == ttys[j])
|
||||||
report_registering(ttys[j]);
|
report_registering(ttys[j]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ipw_tty *ipwireless_tty_create(struct ipw_hardware *hardware,
|
struct ipw_tty *ipwireless_tty_create(struct ipw_hardware *hardware,
|
||||||
struct ipw_network *network,
|
struct ipw_network *network)
|
||||||
dev_node_t *nodes)
|
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
@ -539,26 +533,23 @@ struct ipw_tty *ipwireless_tty_create(struct ipw_hardware *hardware,
|
|||||||
if (allfree) {
|
if (allfree) {
|
||||||
j = i;
|
j = i;
|
||||||
|
|
||||||
if (add_tty(&nodes[0], j, hardware, network,
|
if (add_tty(j, hardware, network,
|
||||||
IPW_CHANNEL_DIALLER, IPW_CHANNEL_RAS,
|
IPW_CHANNEL_DIALLER, IPW_CHANNEL_RAS,
|
||||||
TTYTYPE_MODEM))
|
TTYTYPE_MODEM))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
j += IPWIRELESS_PCMCIA_MINOR_RANGE;
|
j += IPWIRELESS_PCMCIA_MINOR_RANGE;
|
||||||
if (add_tty(&nodes[1], j, hardware, network,
|
if (add_tty(j, hardware, network,
|
||||||
IPW_CHANNEL_DIALLER, -1,
|
IPW_CHANNEL_DIALLER, -1,
|
||||||
TTYTYPE_MONITOR))
|
TTYTYPE_MONITOR))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
j += IPWIRELESS_PCMCIA_MINOR_RANGE;
|
j += IPWIRELESS_PCMCIA_MINOR_RANGE;
|
||||||
if (add_tty(NULL, j, hardware, network,
|
if (add_tty(j, hardware, network,
|
||||||
IPW_CHANNEL_RAS, -1,
|
IPW_CHANNEL_RAS, -1,
|
||||||
TTYTYPE_RAS_RAW))
|
TTYTYPE_RAS_RAW))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
nodes[0].next = &nodes[1];
|
|
||||||
nodes[1].next = NULL;
|
|
||||||
|
|
||||||
return ttys[i];
|
return ttys[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,7 @@ int ipwireless_tty_init(void);
|
|||||||
void ipwireless_tty_release(void);
|
void ipwireless_tty_release(void);
|
||||||
|
|
||||||
struct ipw_tty *ipwireless_tty_create(struct ipw_hardware *hw,
|
struct ipw_tty *ipwireless_tty_create(struct ipw_hardware *hw,
|
||||||
struct ipw_network *net,
|
struct ipw_network *net);
|
||||||
dev_node_t *nodes);
|
|
||||||
void ipwireless_tty_free(struct ipw_tty *tty);
|
void ipwireless_tty_free(struct ipw_tty *tty);
|
||||||
void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
|
void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
|
||||||
unsigned int length);
|
unsigned int length);
|
||||||
|
@ -62,31 +62,6 @@ static void avma1cs_release(struct pcmcia_device *link);
|
|||||||
static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ;
|
static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
A linked list of "instances" of the skeleton device. Each actual
|
|
||||||
PCMCIA card corresponds to one device instance, and is described
|
|
||||||
by one struct pcmcia_device structure (defined in ds.h).
|
|
||||||
|
|
||||||
You may not want to use a linked list for this -- for example, the
|
|
||||||
memory card driver uses an array of struct pcmcia_device pointers, where minor
|
|
||||||
device numbers are used to derive the corresponding array index.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
A driver needs to provide a dev_node_t structure for each device
|
|
||||||
on a card. In some cases, there is only one device per card (for
|
|
||||||
example, ethernet cards, modems). In other cases, there may be
|
|
||||||
many actual or logical devices (SCSI adapters, memory cards with
|
|
||||||
multiple partitions). The dev_node_t structures need to be kept
|
|
||||||
in a linked list starting at the 'dev' field of a struct pcmcia_device
|
|
||||||
structure. We allocate them in the card's private data structure,
|
|
||||||
because they generally can't be allocated dynamically.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct local_info_t {
|
|
||||||
dev_node_t node;
|
|
||||||
} local_info_t;
|
|
||||||
|
|
||||||
/*======================================================================
|
/*======================================================================
|
||||||
|
|
||||||
avma1cs_attach() creates an "instance" of the driver, allocating
|
avma1cs_attach() creates an "instance" of the driver, allocating
|
||||||
@ -101,17 +76,8 @@ typedef struct local_info_t {
|
|||||||
|
|
||||||
static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
|
static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
|
||||||
{
|
{
|
||||||
local_info_t *local;
|
|
||||||
|
|
||||||
dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
|
dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
|
||||||
|
|
||||||
/* Allocate space for private device-specific data */
|
|
||||||
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
|
||||||
if (!local)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
p_dev->priv = local;
|
|
||||||
|
|
||||||
/* The io structure describes IO port mapping */
|
/* The io structure describes IO port mapping */
|
||||||
p_dev->io.NumPorts1 = 16;
|
p_dev->io.NumPorts1 = 16;
|
||||||
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||||
@ -173,14 +139,11 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev,
|
|||||||
|
|
||||||
static int __devinit avma1cs_config(struct pcmcia_device *link)
|
static int __devinit avma1cs_config(struct pcmcia_device *link)
|
||||||
{
|
{
|
||||||
local_info_t *dev;
|
|
||||||
int i = -1;
|
int i = -1;
|
||||||
char devname[128];
|
char devname[128];
|
||||||
IsdnCard_t icard;
|
IsdnCard_t icard;
|
||||||
int busy = 0;
|
int busy = 0;
|
||||||
|
|
||||||
dev = link->priv;
|
|
||||||
|
|
||||||
dev_dbg(&link->dev, "avma1cs_config(0x%p)\n", link);
|
dev_dbg(&link->dev, "avma1cs_config(0x%p)\n", link);
|
||||||
|
|
||||||
devname[0] = 0;
|
devname[0] = 0;
|
||||||
@ -211,14 +174,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
|
|||||||
|
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
/* At this point, the dev_node_t structure(s) should be
|
|
||||||
initialized and arranged in a linked list at link->dev. */
|
|
||||||
|
|
||||||
strcpy(dev->node.dev_name, "A1");
|
|
||||||
dev->node.major = 45;
|
|
||||||
dev->node.minor = 0;
|
|
||||||
link->dev_node = &dev->node;
|
|
||||||
|
|
||||||
/* If any step failed, release any partially configured state */
|
/* If any step failed, release any partially configured state */
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
avma1cs_release(link);
|
avma1cs_release(link);
|
||||||
@ -239,7 +194,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
|
|||||||
avma1cs_release(link);
|
avma1cs_release(link);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
dev->node.minor = i;
|
link->priv = (void *) (unsigned long) i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} /* avma1cs_config */
|
} /* avma1cs_config */
|
||||||
@ -254,12 +209,12 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
|
|||||||
|
|
||||||
static void avma1cs_release(struct pcmcia_device *link)
|
static void avma1cs_release(struct pcmcia_device *link)
|
||||||
{
|
{
|
||||||
local_info_t *local = link->priv;
|
unsigned long minor = (unsigned long) link->priv;
|
||||||
|
|
||||||
dev_dbg(&link->dev, "avma1cs_release(0x%p)\n", link);
|
dev_dbg(&link->dev, "avma1cs_release(0x%p)\n", link);
|
||||||
|
|
||||||
/* now unregister function with hisax */
|
/* now unregister function with hisax */
|
||||||
HiSax_closecard(local->node.minor);
|
HiSax_closecard(minor);
|
||||||
|
|
||||||
pcmcia_disable_device(link);
|
pcmcia_disable_device(link);
|
||||||
} /* avma1cs_release */
|
} /* avma1cs_release */
|
||||||
|
Loading…
Reference in New Issue
Block a user