提交 b5cb259e 编写于 作者: D Dominik Brodowski

pcmcia: remove memreq_t

Page already had to be set to 0; Offset can easily be passed as
parameter to pcmcia_map_mem_page.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: linux-bluetooth@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Michael Buesch <mb@bu3sch.de>
Signed-off-by: NDominik Brodowski <linux@dominikbrodowski.net>
上级 a3d0d4d8
......@@ -84,8 +84,6 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
{
struct ipw_dev *ipw = priv_data;
struct resource *io_resource;
memreq_t memreq_attr_memory;
memreq_t memreq_common_memory;
int ret;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
......@@ -121,11 +119,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
if (ret != 0)
goto exit1;
memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr;
memreq_common_memory.Page = 0;
ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory,
&memreq_common_memory);
cfg->mem.win[0].card_addr);
if (ret != 0)
goto exit2;
......@@ -150,12 +145,7 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
if (ret != 0)
goto exit2;
memreq_attr_memory.CardOffset = 0;
memreq_attr_memory.Page = 0;
ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory,
&memreq_attr_memory);
ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0);
if (ret != 0)
goto exit3;
......
......@@ -232,7 +232,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
*/
if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
memreq_t map;
req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
req->Attributes |= WIN_ENABLE;
req->Base = mem->win[0].host_addr;
......@@ -240,9 +239,9 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
req->AccessSpeed = 0;
if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0)
return -ENODEV;
map.Page = 0;
map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0)
if (pcmcia_map_mem_page(p_dev, p_dev->win,
mem->win[0].card_addr) != 0)
return -ENODEV;
}
return 0;
......
......@@ -102,7 +102,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
{
struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
window_handle_t win = (window_handle_t)map->map_priv_2;
memreq_t mrq;
unsigned int offset;
int ret;
if (!pcmcia_dev_present(dev->p_dev)) {
......@@ -110,15 +110,14 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
return 0;
}
mrq.CardOffset = to & ~(dev->win_size-1);
if(mrq.CardOffset != dev->offset) {
offset = to & ~(dev->win_size-1);
if (offset != dev->offset) {
DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
dev->offset, mrq.CardOffset);
mrq.Page = 0;
ret = pcmcia_map_mem_page(dev->p_dev, win, &mrq);
dev->offset, offset);
ret = pcmcia_map_mem_page(dev->p_dev, win, offset);
if (ret != 0)
return NULL;
dev->offset = mrq.CardOffset;
dev->offset = offset;
}
return dev->win_base + (to & (dev->win_size-1));
}
......
......@@ -545,7 +545,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
{
win_req_t req;
memreq_t mem;
u_char __iomem *base;
int i, j;
......@@ -558,9 +557,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
return -1;
base = ioremap(req.Base, req.Size);
mem.Page = 0;
mem.CardOffset = 0;
pcmcia_map_mem_page(link, link->win, &mem);
pcmcia_map_mem_page(link, link->win, 0);
/*
* MBH10304 CISTPL_FUNCE_LAN_NODE_ID format
......@@ -594,7 +591,6 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
static int fmvj18x_setup_mfc(struct pcmcia_device *link)
{
win_req_t req;
memreq_t mem;
int i;
struct net_device *dev = link->priv;
unsigned int ioaddr;
......@@ -614,9 +610,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link)
return -1;
}
mem.Page = 0;
mem.CardOffset = 0;
i = pcmcia_map_mem_page(link, link->win, &mem);
i = pcmcia_map_mem_page(link, link->win, 0);
if (i != 0) {
iounmap(lp->base);
lp->base = NULL;
......
......@@ -211,7 +211,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
struct net_device *dev = info->dev;
struct tok_info *ti = netdev_priv(dev);
win_req_t req;
memreq_t mem;
int i, ret;
dev_dbg(&link->dev, "ibmtr_config\n");
......@@ -250,9 +249,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
if (ret)
goto failed;
mem.CardOffset = mmiobase;
mem.Page = 0;
ret = pcmcia_map_mem_page(link, link->win, &mem);
ret = pcmcia_map_mem_page(link, link->win, mmiobase);
if (ret)
goto failed;
ti->mmio = ioremap(req.Base, req.Size);
......@@ -267,13 +264,11 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
if (ret)
goto failed;
mem.CardOffset = srambase;
mem.Page = 0;
ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem);
ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase);
if (ret)
goto failed;
ti->sram_base = mem.CardOffset >> 12;
ti->sram_base = srambase >> 12;
ti->sram_virt = ioremap(req.Base, req.Size);
ti->sram_phys = req.Base;
......
......@@ -301,7 +301,6 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
win_req_t req;
memreq_t mem;
u_char __iomem *base, *virt;
int i, j;
......@@ -314,10 +313,8 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
return NULL;
virt = ioremap(req.Base, req.Size);
mem.Page = 0;
for (i = 0; i < NR_INFO; i++) {
mem.CardOffset = hw_info[i].offset & ~(req.Size-1);
pcmcia_map_mem_page(link, link->win, &mem);
pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1));
base = &virt[hw_info[i].offset & (req.Size-1)];
if ((readb(base+0) == hw_info[i].a0) &&
(readb(base+2) == hw_info[i].a1) &&
......@@ -1463,7 +1460,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
struct net_device *dev = link->priv;
pcnet_dev_t *info = PRIV(dev);
win_req_t req;
memreq_t mem;
int i, window_size, offset, ret;
window_size = (stop_pg - start_pg) << 8;
......@@ -1482,11 +1478,9 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
if (ret)
goto failed;
mem.CardOffset = (start_pg << 8) + cm_offset;
offset = mem.CardOffset % window_size;
mem.CardOffset -= offset;
mem.Page = 0;
ret = pcmcia_map_mem_page(link, link->win, &mem);
offset = (start_pg << 8) + cm_offset;
offset -= offset % window_size;
ret = pcmcia_map_mem_page(link, link->win, offset);
if (ret)
goto failed;
......
......@@ -443,7 +443,7 @@ static int mhz_mfc_config(struct pcmcia_device *link)
struct net_device *dev = link->priv;
struct smc_private *smc = netdev_priv(dev);
win_req_t req;
memreq_t mem;
unsigned int offset;
int i;
link->conf.Attributes |= CONF_ENABLE_SPKR;
......@@ -467,11 +467,8 @@ static int mhz_mfc_config(struct pcmcia_device *link)
return -ENODEV;
smc->base = ioremap(req.Base, req.Size);
mem.CardOffset = mem.Page = 0;
if (smc->manfid == MANFID_MOTOROLA)
mem.CardOffset = link->conf.ConfigBase;
i = pcmcia_map_mem_page(link, link->win, &mem);
offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0;
i = pcmcia_map_mem_page(link, link->win, offset);
if ((i == 0) &&
(smc->manfid == MANFID_MEGAHERTZ) &&
(smc->cardid == PRODID_MEGAHERTZ_EM3288))
......
......@@ -870,7 +870,6 @@ xirc2ps_config(struct pcmcia_device * link)
if (local->dingo) {
win_req_t req;
memreq_t mem;
/* Reset the modem's BAR to the correct value
* This is necessary because in the RequestConfiguration call,
......@@ -898,9 +897,7 @@ xirc2ps_config(struct pcmcia_device * link)
goto config_error;
local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800;
mem.CardOffset = 0x0;
mem.Page = 0;
if ((err = pcmcia_map_mem_page(link, link->win, &mem)))
if ((err = pcmcia_map_mem_page(link, link->win, 0)))
goto config_error;
/* Setup the CCRs; there are no infos in the CIS about the Ethernet
......
......@@ -207,16 +207,14 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
*/
if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
memreq_t map;
req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
req->Base = mem->win[0].host_addr;
req->Size = mem->win[0].len;
req->AccessSpeed = 0;
if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0)
return -ENODEV;
map.Page = 0;
map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0)
if (pcmcia_map_mem_page(p_dev, p_dev->win,
mem->win[0].card_addr) != 0)
return -ENODEV;
}
/* If we got this far, we're cool! */
......
......@@ -64,7 +64,6 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
{
struct ssb_bus *ssb;
win_req_t win;
memreq_t mem;
int err = -ENOMEM;
int res = 0;
......@@ -87,9 +86,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
if (res != 0)
goto err_kfree_ssb;
mem.CardOffset = 0;
mem.Page = 0;
res = pcmcia_map_mem_page(dev, dev->win, &mem);
res = pcmcia_map_mem_page(dev, dev->win, 0);
if (res != 0)
goto err_disable;
......
......@@ -393,7 +393,6 @@ static int ray_config(struct pcmcia_device *link)
int ret = 0;
int i;
win_req_t req;
memreq_t mem;
struct net_device *dev = (struct net_device *)link->priv;
ray_dev_t *local = netdev_priv(dev);
......@@ -430,9 +429,7 @@ static int ray_config(struct pcmcia_device *link)
ret = pcmcia_request_window(link, &req, &link->win);
if (ret)
goto failed;
mem.CardOffset = 0x0000;
mem.Page = 0;
ret = pcmcia_map_mem_page(link, link->win, &mem);
ret = pcmcia_map_mem_page(link, link->win, 0);
if (ret)
goto failed;
local->sram = ioremap(req.Base, req.Size);
......@@ -446,9 +443,7 @@ static int ray_config(struct pcmcia_device *link)
ret = pcmcia_request_window(link, &req, &local->rmem_handle);
if (ret)
goto failed;
mem.CardOffset = 0x8000;
mem.Page = 0;
ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem);
ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000);
if (ret)
goto failed;
local->rmem = ioremap(req.Base, req.Size);
......@@ -462,9 +457,7 @@ static int ray_config(struct pcmcia_device *link)
ret = pcmcia_request_window(link, &req, &local->amem_handle);
if (ret)
goto failed;
mem.CardOffset = 0x0000;
mem.Page = 0;
ret = pcmcia_map_mem_page(link, local->amem_handle, &mem);
ret = pcmcia_map_mem_page(link, local->amem_handle, 0);
if (ret)
goto failed;
local->amem = ioremap(req.Base, req.Size);
......
......@@ -193,7 +193,7 @@ EXPORT_SYMBOL(pcmcia_write_config_byte);
int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
memreq_t *req)
unsigned int offset)
{
struct pcmcia_socket *s = p_dev->socket;
int ret;
......@@ -201,12 +201,9 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
wh--;
if (wh >= MAX_WIN)
return -EINVAL;
if (req->Page != 0) {
dev_dbg(&s->dev, "failure: requested page is zero\n");
return -EINVAL;
}
mutex_lock(&s->ops_mutex);
s->win[wh].card_start = req->CardOffset;
s->win[wh].card_start = offset;
ret = s->ops->set_mem_map(s, &s->win[wh]);
if (ret)
dev_warn(&s->dev, "failed to set_mem_map\n");
......
......@@ -1661,7 +1661,6 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
}
if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
memreq_t map;
cistpl_mem_t *mem =
(cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
......@@ -1673,8 +1672,8 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
cfg_mem->req.AccessSpeed = 0;
if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0)
goto next_entry;
map.Page = 0; map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0)
if (pcmcia_map_mem_page(p_dev, p_dev->win,
mem->win[0].card_addr) != 0)
goto next_entry;
cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size);
......
......@@ -556,7 +556,6 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
void *priv_data)
{
win_req_t *req = priv_data;
memreq_t map;
if (cfg->index == 0)
return -ENODEV;
......@@ -602,9 +601,8 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
req->AccessSpeed = 0;
if (pcmcia_request_window(p_dev, req, &p_dev->win))
return -ENODEV;
map.Page = 0;
map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(p_dev, p_dev->win, &map))
if (pcmcia_map_mem_page(p_dev, p_dev->win,
mem->win[0].card_addr))
return -ENODEV;
}
/* If we got this far, we're cool! */
......
......@@ -308,7 +308,6 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
void *priv_data)
{
win_req_t *req = priv_data;
memreq_t map;
if (cfg->index == 0)
return -ENODEV;
......@@ -354,9 +353,8 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
req->AccessSpeed = 0;
if (pcmcia_request_window(p_dev, req, &p_dev->win))
return -ENODEV;
map.Page = 0;
map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(p_dev, p_dev->win, &map))
if (pcmcia_map_mem_page(p_dev, p_dev->win,
mem->win[0].card_addr))
return -ENODEV;
}
/* If we got this far, we're cool! */
......
......@@ -286,7 +286,6 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev,
void *priv_data)
{
win_req_t *req = priv_data;
memreq_t map;
if (cfg->index == 0)
return -ENODEV;
......@@ -332,9 +331,8 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev,
req->AccessSpeed = 0;
if (pcmcia_request_window(p_dev, req, &p_dev->win))
return -ENODEV;
map.Page = 0;
map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(p_dev, p_dev->win, &map))
if (pcmcia_map_mem_page(p_dev, p_dev->win,
mem->win[0].card_addr))
return -ENODEV;
}
/* If we got this far, we're cool! */
......
......@@ -68,12 +68,6 @@ typedef struct config_req_t {
#define PRESENT_IOBASE_3 0x100
#define PRESENT_IOSIZE 0x200
/* For GetMemPage, MapMemPage */
typedef struct memreq_t {
u_int CardOffset;
u_short Page;
} memreq_t;
/* For RequestWindow */
typedef struct win_req_t {
u_int Attributes;
......
......@@ -202,7 +202,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req,
window_handle_t *wh);
int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win);
int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win,
memreq_t *req);
unsigned int offset);
int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
void pcmcia_disable_device(struct pcmcia_device *p_dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册