mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (char)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Only some rare extra debug checks in cm4000_cs.c cm4040_cs.c are now hidden behind a "#ifdef CM4000_DEBUG" or "#ifdef CM4040_DEBUG". Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: Harald Welte <laforge@gnumonks.org> CC: Jiri Kosina <jkosina@suse.cz> CC: David Sterba <dsterba@suse.cz> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
9ac3e58cef
commit
cbf624f0e1
4 changed files with 63 additions and 107 deletions
|
@ -23,8 +23,6 @@
|
||||||
* All rights reserved. Licensed under dual BSD/GPL license.
|
* All rights reserved. Licensed under dual BSD/GPL license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* #define PCMCIA_DEBUG 6 */
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
@ -47,18 +45,17 @@
|
||||||
|
|
||||||
/* #define ATR_CSUM */
|
/* #define ATR_CSUM */
|
||||||
|
|
||||||
#ifdef PCMCIA_DEBUG
|
|
||||||
#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
|
#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
|
||||||
static int pc_debug = PCMCIA_DEBUG;
|
|
||||||
module_param(pc_debug, int, 0600);
|
/* n (debug level) is ignored */
|
||||||
#define DEBUGP(n, rdr, x, args...) do { \
|
/* additional debug output may be enabled by re-compiling with
|
||||||
if (pc_debug >= (n)) \
|
* CM4000_DEBUG set */
|
||||||
dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \
|
/* #define CM4000_DEBUG */
|
||||||
__func__ , ## args); \
|
#define DEBUGP(n, rdr, x, args...) do { \
|
||||||
|
dev_dbg(reader_to_dev(rdr), "%s:" x, \
|
||||||
|
__func__ , ## args); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
|
||||||
#define DEBUGP(n, rdr, x, args...)
|
|
||||||
#endif
|
|
||||||
static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
|
static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
|
||||||
|
|
||||||
#define T_1SEC (HZ)
|
#define T_1SEC (HZ)
|
||||||
|
@ -174,14 +171,13 @@ static unsigned char fi_di_table[10][14] = {
|
||||||
/* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9}
|
/* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef PCMCIA_DEBUG
|
#ifndef CM4000_DEBUG
|
||||||
#define xoutb outb
|
#define xoutb outb
|
||||||
#define xinb inb
|
#define xinb inb
|
||||||
#else
|
#else
|
||||||
static inline void xoutb(unsigned char val, unsigned short port)
|
static inline void xoutb(unsigned char val, unsigned short port)
|
||||||
{
|
{
|
||||||
if (pc_debug >= 7)
|
pr_debug("outb(val=%.2x,port=%.4x)\n", val, port);
|
||||||
printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port);
|
|
||||||
outb(val, port);
|
outb(val, port);
|
||||||
}
|
}
|
||||||
static inline unsigned char xinb(unsigned short port)
|
static inline unsigned char xinb(unsigned short port)
|
||||||
|
@ -189,8 +185,7 @@ static inline unsigned char xinb(unsigned short port)
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
|
|
||||||
val = inb(port);
|
val = inb(port);
|
||||||
if (pc_debug >= 7)
|
pr_debug("%.2x=inb(%.4x)\n", val, port);
|
||||||
printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port);
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -514,12 +509,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
xoutb(i, REG_BUF_ADDR(iobase));
|
xoutb(i, REG_BUF_ADDR(iobase));
|
||||||
xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */
|
xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4000_DEBUG
|
||||||
if (pc_debug >= 5)
|
pr_debug("0x%.2x ", dev->pts[i]);
|
||||||
printk("0x%.2x ", dev->pts[i]);
|
|
||||||
}
|
}
|
||||||
if (pc_debug >= 5)
|
pr_debug("\n");
|
||||||
printk("\n");
|
|
||||||
#else
|
#else
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -579,14 +572,13 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
|
||||||
pts_reply[i] = inb(REG_BUF_DATA(iobase));
|
pts_reply[i] = inb(REG_BUF_DATA(iobase));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4000_DEBUG
|
||||||
DEBUGP(2, dev, "PTSreply: ");
|
DEBUGP(2, dev, "PTSreply: ");
|
||||||
for (i = 0; i < num_bytes_read; i++) {
|
for (i = 0; i < num_bytes_read; i++) {
|
||||||
if (pc_debug >= 5)
|
pr_debug("0x%.2x ", pts_reply[i]);
|
||||||
printk("0x%.2x ", pts_reply[i]);
|
|
||||||
}
|
}
|
||||||
printk("\n");
|
pr_debug("\n");
|
||||||
#endif /* PCMCIA_DEBUG */
|
#endif /* CM4000_DEBUG */
|
||||||
|
|
||||||
DEBUGP(5, dev, "Clear Tactive in Flags1\n");
|
DEBUGP(5, dev, "Clear Tactive in Flags1\n");
|
||||||
xoutb(0x20, REG_FLAGS1(iobase));
|
xoutb(0x20, REG_FLAGS1(iobase));
|
||||||
|
@ -655,7 +647,7 @@ static void terminate_monitor(struct cm4000_dev *dev)
|
||||||
|
|
||||||
DEBUGP(5, dev, "Delete timer\n");
|
DEBUGP(5, dev, "Delete timer\n");
|
||||||
del_timer_sync(&dev->timer);
|
del_timer_sync(&dev->timer);
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4000_DEBUG
|
||||||
dev->monitor_running = 0;
|
dev->monitor_running = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -898,7 +890,7 @@ static void monitor_card(unsigned long p)
|
||||||
DEBUGP(4, dev, "ATR checksum (0x%.2x, should "
|
DEBUGP(4, dev, "ATR checksum (0x%.2x, should "
|
||||||
"be zero) failed\n", dev->atr_csum);
|
"be zero) failed\n", dev->atr_csum);
|
||||||
}
|
}
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4000_DEBUG
|
||||||
else if (test_bit(IS_BAD_LENGTH, &dev->flags)) {
|
else if (test_bit(IS_BAD_LENGTH, &dev->flags)) {
|
||||||
DEBUGP(4, dev, "ATR length error\n");
|
DEBUGP(4, dev, "ATR length error\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1415,7 +1407,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
int size;
|
int size;
|
||||||
int rc;
|
int rc;
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4000_DEBUG
|
||||||
char *ioctl_names[CM_IOC_MAXNR + 1] = {
|
char *ioctl_names[CM_IOC_MAXNR + 1] = {
|
||||||
[_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS",
|
[_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS",
|
||||||
[_IOC_NR(CM_IOCGATR)] "CM_IOCGATR",
|
[_IOC_NR(CM_IOCGATR)] "CM_IOCGATR",
|
||||||
|
@ -1423,9 +1415,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
[_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS",
|
[_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS",
|
||||||
[_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL",
|
[_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL",
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode),
|
DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode),
|
||||||
iminor(inode), ioctl_names[_IOC_NR(cmd)]);
|
iminor(inode), ioctl_names[_IOC_NR(cmd)]);
|
||||||
|
#endif
|
||||||
|
|
||||||
lock_kernel();
|
lock_kernel();
|
||||||
rc = -ENODEV;
|
rc = -ENODEV;
|
||||||
|
@ -1523,7 +1515,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
}
|
}
|
||||||
case CM_IOCARDOFF:
|
case CM_IOCARDOFF:
|
||||||
|
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4000_DEBUG
|
||||||
DEBUGP(4, dev, "... in CM_IOCARDOFF\n");
|
DEBUGP(4, dev, "... in CM_IOCARDOFF\n");
|
||||||
if (dev->flags0 & 0x01) {
|
if (dev->flags0 & 0x01) {
|
||||||
DEBUGP(4, dev, " Card inserted\n");
|
DEBUGP(4, dev, " Card inserted\n");
|
||||||
|
@ -1625,18 +1617,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4000_DEBUG
|
||||||
case CM_IOSDBGLVL: /* set debug log level */
|
case CM_IOSDBGLVL:
|
||||||
{
|
rc = -ENOTTY;
|
||||||
int old_pc_debug = 0;
|
|
||||||
|
|
||||||
old_pc_debug = pc_debug;
|
|
||||||
if (copy_from_user(&pc_debug, argp, sizeof(int)))
|
|
||||||
rc = -EFAULT;
|
|
||||||
else if (old_pc_debug != pc_debug)
|
|
||||||
DEBUGP(0, dev, "Changed debug log level "
|
|
||||||
"to %i\n", pc_debug);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* All rights reserved, Dual BSD/GPL Licensed.
|
* All rights reserved, Dual BSD/GPL Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* #define PCMCIA_DEBUG 6 */
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
@ -41,18 +39,16 @@
|
||||||
#include "cm4040_cs.h"
|
#include "cm4040_cs.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef PCMCIA_DEBUG
|
|
||||||
#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
|
#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
|
||||||
static int pc_debug = PCMCIA_DEBUG;
|
|
||||||
module_param(pc_debug, int, 0600);
|
/* n (debug level) is ignored */
|
||||||
#define DEBUGP(n, rdr, x, args...) do { \
|
/* additional debug output may be enabled by re-compiling with
|
||||||
if (pc_debug >= (n)) \
|
* CM4040_DEBUG set */
|
||||||
dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \
|
/* #define CM4040_DEBUG */
|
||||||
__func__ , ##args); \
|
#define DEBUGP(n, rdr, x, args...) do { \
|
||||||
|
dev_dbg(reader_to_dev(rdr), "%s:" x, \
|
||||||
|
__func__ , ## args); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
|
||||||
#define DEBUGP(n, rdr, x, args...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char *version =
|
static char *version =
|
||||||
"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
|
"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
|
||||||
|
@ -90,14 +86,13 @@ struct reader_dev {
|
||||||
|
|
||||||
static struct pcmcia_device *dev_table[CM_MAX_DEV];
|
static struct pcmcia_device *dev_table[CM_MAX_DEV];
|
||||||
|
|
||||||
#ifndef PCMCIA_DEBUG
|
#ifndef CM4040_DEBUG
|
||||||
#define xoutb outb
|
#define xoutb outb
|
||||||
#define xinb inb
|
#define xinb inb
|
||||||
#else
|
#else
|
||||||
static inline void xoutb(unsigned char val, unsigned short port)
|
static inline void xoutb(unsigned char val, unsigned short port)
|
||||||
{
|
{
|
||||||
if (pc_debug >= 7)
|
pr_debug("outb(val=%.2x,port=%.4x)\n", val, port);
|
||||||
printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port);
|
|
||||||
outb(val, port);
|
outb(val, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,8 +101,7 @@ static inline unsigned char xinb(unsigned short port)
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
|
|
||||||
val = inb(port);
|
val = inb(port);
|
||||||
if (pc_debug >= 7)
|
pr_debug("%.2x=inb(%.4x)\n", val, port);
|
||||||
printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port);
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -260,11 +254,10 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN);
|
dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN);
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4040_DEBUG
|
||||||
if (pc_debug >= 6)
|
pr_debug("%lu:%2x ", i, dev->r_buf[i]);
|
||||||
printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]);
|
|
||||||
}
|
}
|
||||||
printk("\n");
|
pr_debug("\n");
|
||||||
#else
|
#else
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -288,11 +281,10 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN);
|
dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN);
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef CM4040_DEBUG
|
||||||
if (pc_debug >= 6)
|
pr_debug("%lu:%2x ", i, dev->r_buf[i]);
|
||||||
printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]);
|
|
||||||
}
|
}
|
||||||
printk("\n");
|
pr_debug("\n");
|
||||||
#else
|
#else
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,10 +65,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot)
|
||||||
struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev,
|
struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev,
|
||||||
work_reboot);
|
work_reboot);
|
||||||
struct pcmcia_device *link = ipw->link;
|
struct pcmcia_device *link = ipw->link;
|
||||||
int ret = pcmcia_reset_card(link->socket);
|
pcmcia_reset_card(link->socket);
|
||||||
|
|
||||||
if (ret != 0)
|
|
||||||
cs_error(link, ResetCard, ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signalled_reboot_callback(void *callback_data)
|
static void signalled_reboot_callback(void *callback_data)
|
||||||
|
@ -122,10 +119,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
|
||||||
ret = pcmcia_request_window(&p_dev, &ipw->request_common_memory,
|
ret = pcmcia_request_window(&p_dev, &ipw->request_common_memory,
|
||||||
&ipw->handle_common_memory);
|
&ipw->handle_common_memory);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
cs_error(p_dev, RequestWindow, ret);
|
|
||||||
goto exit1;
|
goto exit1;
|
||||||
}
|
|
||||||
|
|
||||||
memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr;
|
memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr;
|
||||||
memreq_common_memory.Page = 0;
|
memreq_common_memory.Page = 0;
|
||||||
|
@ -133,10 +128,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
|
||||||
ret = pcmcia_map_mem_page(ipw->handle_common_memory,
|
ret = pcmcia_map_mem_page(ipw->handle_common_memory,
|
||||||
&memreq_common_memory);
|
&memreq_common_memory);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
cs_error(p_dev, MapMemPage, ret);
|
|
||||||
goto exit2;
|
goto exit2;
|
||||||
}
|
|
||||||
|
|
||||||
ipw->is_v2_card = cfg->mem.win[0].len == 0x100;
|
ipw->is_v2_card = cfg->mem.win[0].len == 0x100;
|
||||||
|
|
||||||
|
@ -155,10 +148,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
|
||||||
ret = pcmcia_request_window(&p_dev, &ipw->request_attr_memory,
|
ret = pcmcia_request_window(&p_dev, &ipw->request_attr_memory,
|
||||||
&ipw->handle_attr_memory);
|
&ipw->handle_attr_memory);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
cs_error(p_dev, RequestWindow, ret);
|
|
||||||
goto exit2;
|
goto exit2;
|
||||||
}
|
|
||||||
|
|
||||||
memreq_attr_memory.CardOffset = 0;
|
memreq_attr_memory.CardOffset = 0;
|
||||||
memreq_attr_memory.Page = 0;
|
memreq_attr_memory.Page = 0;
|
||||||
|
@ -166,10 +157,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
|
||||||
ret = pcmcia_map_mem_page(ipw->handle_attr_memory,
|
ret = pcmcia_map_mem_page(ipw->handle_attr_memory,
|
||||||
&memreq_attr_memory);
|
&memreq_attr_memory);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
cs_error(p_dev, MapMemPage, ret);
|
|
||||||
goto exit3;
|
goto exit3;
|
||||||
}
|
|
||||||
|
|
||||||
ipw->attr_memory = ioremap(ipw->request_attr_memory.Base,
|
ipw->attr_memory = ioremap(ipw->request_attr_memory.Base,
|
||||||
ipw->request_attr_memory.Size);
|
ipw->request_attr_memory.Size);
|
||||||
|
@ -202,10 +191,8 @@ static int config_ipwireless(struct ipw_dev *ipw)
|
||||||
ipw->is_v2_card = 0;
|
ipw->is_v2_card = 0;
|
||||||
|
|
||||||
ret = pcmcia_loop_config(link, ipwireless_probe, ipw);
|
ret = pcmcia_loop_config(link, ipwireless_probe, ipw);
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
cs_error(link, RequestIO, ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||||
|
@ -223,10 +210,8 @@ static int config_ipwireless(struct ipw_dev *ipw)
|
||||||
|
|
||||||
ret = pcmcia_request_irq(link, &link->irq);
|
ret = pcmcia_request_irq(link, &link->irq);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
cs_error(link, RequestIRQ, ret);
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
|
||||||
|
|
||||||
printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n",
|
printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n",
|
||||||
ipw->is_v2_card ? "V2/V3" : "V1");
|
ipw->is_v2_card ? "V2/V3" : "V1");
|
||||||
|
@ -263,10 +248,8 @@ static int config_ipwireless(struct ipw_dev *ipw)
|
||||||
*/
|
*/
|
||||||
ret = pcmcia_request_configuration(link, &link->conf);
|
ret = pcmcia_request_configuration(link, &link->conf);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
cs_error(link, RequestConfiguration, ret);
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
|
||||||
|
|
||||||
link->dev_node = &ipw->nodes[0];
|
link->dev_node = &ipw->nodes[0];
|
||||||
|
|
||||||
|
@ -347,7 +330,6 @@ static int ipwireless_attach(struct pcmcia_device *link)
|
||||||
ret = config_ipwireless(ipw);
|
ret = config_ipwireless(ipw);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
cs_error(link, RegisterClient, ret);
|
|
||||||
ipwireless_detach(link);
|
ipwireless_detach(link);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,9 +572,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
|
||||||
/* Card has been inserted.
|
/* Card has been inserted.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CS_CHECK(fn, ret) \
|
|
||||||
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|
||||||
|
|
||||||
static int mgslpc_ioprobe(struct pcmcia_device *p_dev,
|
static int mgslpc_ioprobe(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
@ -598,15 +595,14 @@ static int mgslpc_ioprobe(struct pcmcia_device *p_dev,
|
||||||
static int mgslpc_config(struct pcmcia_device *link)
|
static int mgslpc_config(struct pcmcia_device *link)
|
||||||
{
|
{
|
||||||
MGSLPC_INFO *info = link->priv;
|
MGSLPC_INFO *info = link->priv;
|
||||||
int last_fn = RequestIO;
|
int ret;
|
||||||
int last_ret;
|
|
||||||
|
|
||||||
if (debug_level >= DEBUG_LEVEL_INFO)
|
if (debug_level >= DEBUG_LEVEL_INFO)
|
||||||
printk("mgslpc_config(0x%p)\n", link);
|
printk("mgslpc_config(0x%p)\n", link);
|
||||||
|
|
||||||
last_ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
|
ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
|
||||||
if (last_ret != 0)
|
if (ret != 0)
|
||||||
goto cs_failed;
|
goto failed;
|
||||||
|
|
||||||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||||
|
@ -616,9 +612,13 @@ static int mgslpc_config(struct pcmcia_device *link)
|
||||||
link->irq.Attributes |= IRQ_HANDLE_PRESENT;
|
link->irq.Attributes |= IRQ_HANDLE_PRESENT;
|
||||||
link->irq.Handler = mgslpc_isr;
|
link->irq.Handler = mgslpc_isr;
|
||||||
link->irq.Instance = info;
|
link->irq.Instance = info;
|
||||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
|
||||||
|
|
||||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
ret = pcmcia_request_irq(link, &link->irq);
|
||||||
|
if (ret)
|
||||||
|
goto failed;
|
||||||
|
ret = pcmcia_request_configuration(link, &link->conf);
|
||||||
|
if (ret)
|
||||||
|
goto failed;
|
||||||
|
|
||||||
info->io_base = link->io.BasePort1;
|
info->io_base = link->io.BasePort1;
|
||||||
info->irq_level = link->irq.AssignedIRQ;
|
info->irq_level = link->irq.AssignedIRQ;
|
||||||
|
@ -638,8 +638,7 @@ static int mgslpc_config(struct pcmcia_device *link)
|
||||||
printk("\n");
|
printk("\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cs_failed:
|
failed:
|
||||||
cs_error(link, last_fn, last_ret);
|
|
||||||
mgslpc_release((u_long)link);
|
mgslpc_release((u_long)link);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue