[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
@@ -71,8 +71,8 @@ struct orinoco_pccard {
|
||||
/* Function prototypes */
|
||||
/********************************************************************/
|
||||
|
||||
static void spectrum_cs_config(dev_link_t *link);
|
||||
static void spectrum_cs_release(dev_link_t *link);
|
||||
static void spectrum_cs_config(struct pcmcia_device *link);
|
||||
static void spectrum_cs_release(struct pcmcia_device *link);
|
||||
|
||||
/********************************************************************/
|
||||
/* Firmware downloader */
|
||||
@@ -238,7 +238,7 @@ spectrum_aux_open(hermes_t *hw)
|
||||
* If IDLE is 1, stop the firmware, so that it can be safely rewritten.
|
||||
*/
|
||||
static int
|
||||
spectrum_reset(dev_link_t *link, int idle)
|
||||
spectrum_reset(struct pcmcia_device *link, int idle)
|
||||
{
|
||||
int last_ret, last_fn;
|
||||
conf_reg_t reg;
|
||||
@@ -253,7 +253,7 @@ spectrum_reset(dev_link_t *link, int idle)
|
||||
reg.Action = CS_READ;
|
||||
reg.Offset = CISREG_COR;
|
||||
CS_CHECK(AccessConfigurationRegister,
|
||||
pcmcia_access_configuration_register(link->handle, ®));
|
||||
pcmcia_access_configuration_register(link, ®));
|
||||
save_cor = reg.Value;
|
||||
|
||||
/* Soft-Reset card */
|
||||
@@ -261,14 +261,14 @@ spectrum_reset(dev_link_t *link, int idle)
|
||||
reg.Offset = CISREG_COR;
|
||||
reg.Value = (save_cor | COR_SOFT_RESET);
|
||||
CS_CHECK(AccessConfigurationRegister,
|
||||
pcmcia_access_configuration_register(link->handle, ®));
|
||||
pcmcia_access_configuration_register(link, ®));
|
||||
udelay(1000);
|
||||
|
||||
/* Read CCSR */
|
||||
reg.Action = CS_READ;
|
||||
reg.Offset = CISREG_CCSR;
|
||||
CS_CHECK(AccessConfigurationRegister,
|
||||
pcmcia_access_configuration_register(link->handle, ®));
|
||||
pcmcia_access_configuration_register(link, ®));
|
||||
|
||||
/*
|
||||
* Start or stop the firmware. Memory width bit should be
|
||||
@@ -278,7 +278,7 @@ spectrum_reset(dev_link_t *link, int idle)
|
||||
reg.Offset = CISREG_CCSR;
|
||||
reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16);
|
||||
CS_CHECK(AccessConfigurationRegister,
|
||||
pcmcia_access_configuration_register(link->handle, ®));
|
||||
pcmcia_access_configuration_register(link, ®));
|
||||
udelay(1000);
|
||||
|
||||
/* Restore original COR configuration index */
|
||||
@@ -286,12 +286,12 @@ spectrum_reset(dev_link_t *link, int idle)
|
||||
reg.Offset = CISREG_COR;
|
||||
reg.Value = (save_cor & ~COR_SOFT_RESET);
|
||||
CS_CHECK(AccessConfigurationRegister,
|
||||
pcmcia_access_configuration_register(link->handle, ®));
|
||||
pcmcia_access_configuration_register(link, ®));
|
||||
udelay(1000);
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block)
|
||||
* care of the PDA - read it and then write it on top of the firmware.
|
||||
*/
|
||||
static int
|
||||
spectrum_dl_image(hermes_t *hw, dev_link_t *link,
|
||||
spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link,
|
||||
const unsigned char *image)
|
||||
{
|
||||
int ret;
|
||||
@@ -505,14 +505,13 @@ spectrum_dl_image(hermes_t *hw, dev_link_t *link,
|
||||
* reset on the card, to make sure it's in a sane state.
|
||||
*/
|
||||
static int
|
||||
spectrum_dl_firmware(hermes_t *hw, dev_link_t *link)
|
||||
spectrum_dl_firmware(hermes_t *hw, struct pcmcia_device *link)
|
||||
{
|
||||
int ret;
|
||||
client_handle_t handle = link->handle;
|
||||
const struct firmware *fw_entry;
|
||||
|
||||
if (request_firmware(&fw_entry, primary_fw_name,
|
||||
&handle_to_dev(handle)) == 0) {
|
||||
&handle_to_dev(link)) == 0) {
|
||||
primsym = fw_entry->data;
|
||||
} else {
|
||||
printk(KERN_ERR PFX "Cannot find firmware: %s\n",
|
||||
@@ -521,7 +520,7 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link)
|
||||
}
|
||||
|
||||
if (request_firmware(&fw_entry, secondary_fw_name,
|
||||
&handle_to_dev(handle)) == 0) {
|
||||
&handle_to_dev(link)) == 0) {
|
||||
secsym = fw_entry->data;
|
||||
} else {
|
||||
printk(KERN_ERR PFX "Cannot find firmware: %s\n",
|
||||
@@ -554,7 +553,7 @@ static int
|
||||
spectrum_cs_hard_reset(struct orinoco_private *priv)
|
||||
{
|
||||
struct orinoco_pccard *card = priv->card;
|
||||
dev_link_t *link = card->p_dev;
|
||||
struct pcmcia_device *link = card->p_dev;
|
||||
int err;
|
||||
|
||||
if (!hermes_present(&priv->hw)) {
|
||||
@@ -584,12 +583,11 @@ spectrum_cs_hard_reset(struct orinoco_private *priv)
|
||||
* configure the card at this point -- we wait until we receive a card
|
||||
* insertion event. */
|
||||
static int
|
||||
spectrum_cs_attach(struct pcmcia_device *p_dev)
|
||||
spectrum_cs_attach(struct pcmcia_device *link)
|
||||
{
|
||||
struct net_device *dev;
|
||||
struct orinoco_private *priv;
|
||||
struct orinoco_pccard *card;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset);
|
||||
if (! dev)
|
||||
@@ -598,7 +596,7 @@ spectrum_cs_attach(struct pcmcia_device *p_dev)
|
||||
card = priv->card;
|
||||
|
||||
/* Link both structures together */
|
||||
card->p_dev = p_dev;
|
||||
card->p_dev = link;
|
||||
link->priv = dev;
|
||||
|
||||
/* Interrupt setup */
|
||||
@@ -627,9 +625,8 @@ spectrum_cs_attach(struct pcmcia_device *p_dev)
|
||||
* are freed. Otherwise, the structures will be freed when the device
|
||||
* is released.
|
||||
*/
|
||||
static void spectrum_cs_detach(struct pcmcia_device *p_dev)
|
||||
static void spectrum_cs_detach(struct pcmcia_device *link)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
struct net_device *dev = link->priv;
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
@@ -651,10 +648,9 @@ static void spectrum_cs_detach(struct pcmcia_device *p_dev)
|
||||
*/
|
||||
|
||||
static void
|
||||
spectrum_cs_config(dev_link_t *link)
|
||||
spectrum_cs_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct net_device *dev = link->priv;
|
||||
client_handle_t handle = link->handle;
|
||||
struct orinoco_private *priv = netdev_priv(dev);
|
||||
struct orinoco_pccard *card = priv->card;
|
||||
hermes_t *hw = &priv->hw;
|
||||
@@ -666,7 +662,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
cisparse_t parse;
|
||||
void __iomem *mem;
|
||||
|
||||
CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
|
||||
CS_CHECK(ValidateCIS, pcmcia_validate_cis(link, &info));
|
||||
|
||||
/*
|
||||
* This reads the card's CONFIG tuple to find its
|
||||
@@ -677,9 +673,9 @@ spectrum_cs_config(dev_link_t *link)
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
@@ -688,7 +684,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
|
||||
/* Look up the current Vcc */
|
||||
CS_CHECK(GetConfigurationInfo,
|
||||
pcmcia_get_configuration_info(handle, &conf));
|
||||
pcmcia_get_configuration_info(link, &conf));
|
||||
|
||||
/*
|
||||
* In this loop, we scan the CIS for configuration table
|
||||
@@ -705,13 +701,13 @@ spectrum_cs_config(dev_link_t *link)
|
||||
* implementation-defined details.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
while (1) {
|
||||
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
|
||||
cistpl_cftable_entry_t dflt = { .index = 0 };
|
||||
|
||||
if ( (pcmcia_get_tuple_data(handle, &tuple) != 0)
|
||||
|| (pcmcia_parse_tuple(handle, &tuple, &parse) != 0))
|
||||
if ( (pcmcia_get_tuple_data(link, &tuple) != 0)
|
||||
|| (pcmcia_parse_tuple(link, &tuple, &parse) != 0))
|
||||
goto next_entry;
|
||||
|
||||
if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
|
||||
@@ -776,7 +772,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
}
|
||||
|
||||
/* This reserves IO space but doesn't actually enable it */
|
||||
if (pcmcia_request_io(link->handle, &link->io) != 0)
|
||||
if (pcmcia_request_io(link, &link->io) != 0)
|
||||
goto next_entry;
|
||||
}
|
||||
|
||||
@@ -786,8 +782,8 @@ spectrum_cs_config(dev_link_t *link)
|
||||
break;
|
||||
|
||||
next_entry:
|
||||
pcmcia_disable_device(handle);
|
||||
last_ret = pcmcia_get_next_tuple(handle, &tuple);
|
||||
pcmcia_disable_device(link);
|
||||
last_ret = pcmcia_get_next_tuple(link, &tuple);
|
||||
if (last_ret == CS_NO_MORE_ITEMS) {
|
||||
printk(KERN_ERR PFX "GetNextTuple(): No matching "
|
||||
"CIS configuration. Maybe you need the "
|
||||
@@ -801,7 +797,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
* a handler to the interrupt, unless the 'Handler' member of
|
||||
* the irq structure is initialized.
|
||||
*/
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
|
||||
/* We initialize the hermes structure before completing PCMCIA
|
||||
* configuration just in case the interrupt handler gets
|
||||
@@ -818,7 +814,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
* card and host interface into "Memory and IO" mode.
|
||||
*/
|
||||
CS_CHECK(RequestConfiguration,
|
||||
pcmcia_request_configuration(link->handle, &link->conf));
|
||||
pcmcia_request_configuration(link, &link->conf));
|
||||
|
||||
/* Ok, we have the configuration, prepare to register the netdev */
|
||||
dev->base_addr = link->io.BasePort1;
|
||||
@@ -831,7 +827,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(link));
|
||||
/* Tell the stack we exist */
|
||||
if (register_netdev(dev) != 0) {
|
||||
printk(KERN_ERR PFX "register_netdev() failed\n");
|
||||
@@ -864,7 +860,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
|
||||
failed:
|
||||
spectrum_cs_release(link);
|
||||
@@ -876,7 +872,7 @@ spectrum_cs_config(dev_link_t *link)
|
||||
* still open, this will be postponed until it is closed.
|
||||
*/
|
||||
static void
|
||||
spectrum_cs_release(dev_link_t *link)
|
||||
spectrum_cs_release(struct pcmcia_device *link)
|
||||
{
|
||||
struct net_device *dev = link->priv;
|
||||
struct orinoco_private *priv = netdev_priv(dev);
|
||||
@@ -888,16 +884,15 @@ spectrum_cs_release(dev_link_t *link)
|
||||
priv->hw_unavailable++;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
if (priv->hw.iobase)
|
||||
ioport_unmap(priv->hw.iobase);
|
||||
} /* spectrum_cs_release */
|
||||
|
||||
|
||||
static int
|
||||
spectrum_cs_suspend(struct pcmcia_device *p_dev)
|
||||
spectrum_cs_suspend(struct pcmcia_device *link)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
struct net_device *dev = link->priv;
|
||||
struct orinoco_private *priv = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
@@ -922,9 +917,8 @@ spectrum_cs_suspend(struct pcmcia_device *p_dev)
|
||||
}
|
||||
|
||||
static int
|
||||
spectrum_cs_resume(struct pcmcia_device *p_dev)
|
||||
spectrum_cs_resume(struct pcmcia_device *link)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
struct net_device *dev = link->priv;
|
||||
struct orinoco_private *priv = netdev_priv(dev);
|
||||
|
||||
|
Reference in New Issue
Block a user