diff mbox

[14/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (misc drivers)

Message ID 1256413386-20501-14-git-send-email-linux@dominikbrodowski.net
State New, archived
Headers show

Commit Message

Dominik Brodowski Oct. 24, 2009, 7:43 p.m. UTC
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of
requiring manual settings of PCMCIA_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: linux-mtd@lists.infradead.org
CC: linux-usb@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
 drivers/mtd/maps/pcmciamtd.c   |   14 +----------
 drivers/parport/parport_cs.c   |   37 +++++++++++--------------------
 drivers/telephony/ixj_pcmcia.c |   36 +++++++++++--------------------
 drivers/usb/host/sl811_cs.c    |   46 +++++++++++----------------------------
 4 files changed, 41 insertions(+), 92 deletions(-)

Comments

Artem Bityutskiy Oct. 26, 2009, 6:42 a.m. UTC | #1
On Sat, 2009-10-24 at 21:43 +0200, Dominik Brodowski wrote:
> Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of
> requiring manual settings of PCMCIA_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: linux-mtd@lists.infradead.org
> CC: linux-usb@vger.kernel.org
> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

Have you been able to test the driver after the clean-up?
Dominik Brodowski Oct. 26, 2009, 7:13 a.m. UTC | #2
Hey,

On Mon, Oct 26, 2009 at 08:42:11AM +0200, Artem Bityutskiy wrote:
> On Sat, 2009-10-24 at 21:43 +0200, Dominik Brodowski wrote:
> > Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of
> > requiring manual settings of PCMCIA_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: linux-mtd@lists.infradead.org
> > CC: linux-usb@vger.kernel.org
> > Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
> 
> Have you been able to test the driver after the clean-up?

No, I don't have all that much PCMCIA hardware -- and specifically none for
the drivers which were modified in this patch (parport, ixj-telephony,
sl811; pcmcia_mtd is marked broken anyway).

Best,
	Dominik
Artem Bityutskiy Oct. 26, 2009, 7:26 a.m. UTC | #3
On Mon, 2009-10-26 at 08:13 +0100, Dominik Brodowski wrote:
> Hey,
> 
> On Mon, Oct 26, 2009 at 08:42:11AM +0200, Artem Bityutskiy wrote:
> > On Sat, 2009-10-24 at 21:43 +0200, Dominik Brodowski wrote:
> > > Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of
> > > requiring manual settings of PCMCIA_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: linux-mtd@lists.infradead.org
> > > CC: linux-usb@vger.kernel.org
> > > Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
> > 
> > Have you been able to test the driver after the clean-up?
> 
> No, I don't have all that much PCMCIA hardware -- and specifically none for
> the drivers which were modified in this patch (parport, ixj-telephony,
> sl811; pcmcia_mtd is marked broken anyway).

This driver is old and ugly, and it is even possible that no one uses it
anymore, so I guess getting clean-ups without testing is ok for it.
However, in that case the clean-up patches should be reviewable, which I
wouldn't say about your patch :-)

Could you please split it on several smaller patches, each doing one
thing only?
Dominik Brodowski Oct. 26, 2009, 7:56 a.m. UTC | #4
On Mon, Oct 26, 2009 at 09:26:31AM +0200, Artem Bityutskiy wrote:
> > No, I don't have all that much PCMCIA hardware -- and specifically none for
> > the drivers which were modified in this patch (parport, ixj-telephony,
> > sl811; pcmcia_mtd is marked broken anyway).
> 
> This driver is old and ugly, and it is even possible that no one uses it
> anymore, so I guess getting clean-ups without testing is ok for it.

Which one are you referring to specifically?

> However, in that case the clean-up patches should be reviewable, which I
> wouldn't say about your patch :-)

It are "only" 46 line changes max per driver?

> Could you please split it on several smaller patches, each doing one
> thing only?

Well, I could split up the -- related -- CS_CHECK() and dev_dbg() parts if
_really_ necessary.

Best,
	Dominik
Artem Bityutskiy Oct. 26, 2009, 8:05 a.m. UTC | #5
On Mon, 2009-10-26 at 08:56 +0100, Dominik Brodowski wrote:
> On Mon, Oct 26, 2009 at 09:26:31AM +0200, Artem Bityutskiy wrote:
> > > No, I don't have all that much PCMCIA hardware -- and specifically none for
> > > the drivers which were modified in this patch (parport, ixj-telephony,
> > > sl811; pcmcia_mtd is marked broken anyway).
> > 
> > This driver is old and ugly, and it is even possible that no one uses it
> > anymore, so I guess getting clean-ups without testing is ok for it.
> 
> Which one are you referring to specifically?

Actually I referred to pcmciamtd. I was confused a little, sorry.

> > However, in that case the clean-up patches should be reviewable, which I
> > wouldn't say about your patch :-)
> 
> It are "only" 46 line changes max per driver?
> 
> > Could you please split it on several smaller patches, each doing one
> > thing only?
> 
> Well, I could split up the -- related -- CS_CHECK() and dev_dbg() parts if
> _really_ necessary.

I cannot comment about "_really_", this is just what I personally think
would be a good idea, up to you.
Artem Bityutskiy Oct. 26, 2009, 10:18 a.m. UTC | #6
On Mon, 2009-10-26 at 10:19 +0000, Alan Cox wrote:
> > > No, I don't have all that much PCMCIA hardware -- and specifically none for
> > > the drivers which were modified in this patch (parport, ixj-telephony,
> > > sl811; pcmcia_mtd is marked broken anyway).
> > 
> > This driver is old and ugly, and it is even possible that no one uses it
> > anymore, so I guess getting clean-ups without testing is ok for it.
> > However, in that case the clean-up patches should be reviewable, which I
> > wouldn't say about your patch :-)
> > 
> > Could you please split it on several smaller patches, each doing one
> > thing only?
> 
> pcmcia_mtd has been marked broken for how long - better to delete it ?
> It's in the git history if anyone ever wants to resurrect it.

I do not have objections. David?
Alan Cox Oct. 26, 2009, 10:19 a.m. UTC | #7
> > No, I don't have all that much PCMCIA hardware -- and specifically none for
> > the drivers which were modified in this patch (parport, ixj-telephony,
> > sl811; pcmcia_mtd is marked broken anyway).
> 
> This driver is old and ugly, and it is even possible that no one uses it
> anymore, so I guess getting clean-ups without testing is ok for it.
> However, in that case the clean-up patches should be reviewable, which I
> wouldn't say about your patch :-)
> 
> Could you please split it on several smaller patches, each doing one
> thing only?

pcmcia_mtd has been marked broken for how long - better to delete it ?
It's in the git history if anyone ever wants to resurrect it.
Artem Bityutskiy Nov. 3, 2009, 8:37 a.m. UTC | #8
On Mon, 2009-10-26 at 12:18 +0200, Artem Bityutskiy wrote:
> On Mon, 2009-10-26 at 10:19 +0000, Alan Cox wrote:
> > > > No, I don't have all that much PCMCIA hardware -- and specifically none for
> > > > the drivers which were modified in this patch (parport, ixj-telephony,
> > > > sl811; pcmcia_mtd is marked broken anyway).
> > > 
> > > This driver is old and ugly, and it is even possible that no one uses it
> > > anymore, so I guess getting clean-ups without testing is ok for it.
> > > However, in that case the clean-up patches should be reviewable, which I
> > > wouldn't say about your patch :-)
> > > 
> > > Could you please split it on several smaller patches, each doing one
> > > thing only?
> > 
> > pcmcia_mtd has been marked broken for how long - better to delete it ?
> > It's in the git history if anyone ever wants to resurrect it.
> 
> I do not have objections. David?

I suggest to interpret the silence as "ok", go ahead and remove it.
Dominik, do you care enough to send a patch?
Dominik Brodowski Nov. 7, 2009, 11:02 a.m. UTC | #9
Hey,

it seems that just as we were preparing to move pcmciamtd to staging, an
user who still tries to use it has appeared:

> ATTR{modalias}=="pcmcia:m0000c0000f00fn00pfn00paEBF91155pb805360CApc00000000pd00000000"
>     ATTR{prod_id2}=="  2MB SRAM CARD"
>     ATTR{prod_id1}=="PRETEC"
>     ATTR{pm_state}=="on"
>     ATTR{function}=="0x00"

So, what is actually BROKEN with pcmciamtd.c ?

Best,
	Dominik
Komuro Nov. 7, 2009, 11:29 a.m. UTC | #10
Hi,

staging directory is not the place for broken driver,
is it?

>Hey,
>
>it seems that just as we were preparing to move pcmciamtd to staging, an
>user who still tries to use it has appeared:
>
>> ATTR{modalias}=="pcmcia:m0000c0000f00fn00pfn00paEBF91155pb805360CApc0000000
0pd00000000"
>> ? ? ATTR{prod_id2}==" ?2MB SRAM CARD"
>> ? ? ATTR{prod_id1}=="PRETEC"
>> ? ? ATTR{pm_state}=="on"
>> ? ? ATTR{function}=="0x00"
>
>So, what is actually BROKEN with pcmciamtd.c ?

Best Regards
Komuro
Dominik Brodowski Nov. 7, 2009, 11:33 a.m. UTC | #11
Hey,

On Sat, Nov 07, 2009 at 08:29:09PM +0900, Komuro wrote:
> staging directory is not the place for broken driver,
> is it?


It is becoming the place for drivers on their way out of the kernel tree.
An indication for drivers being unused is that they have been marked broken
or obsolete for a loooong time; and then they'll remain in staging for 3
releases or so before being removed (or being moved in again).

Best,
	Dominik
Kristoffer Ericson Nov. 7, 2009, 4:57 p.m. UTC | #12
On Sat, 7 Nov 2009 12:33:46 +0100
Dominik Brodowski <linux@dominikbrodowski.net> wrote:

> Hey,
> 
> On Sat, Nov 07, 2009 at 08:29:09PM +0900, Komuro wrote:
> > staging directory is not the place for broken driver,
> > is it?
> 
> 
> It is becoming the place for drivers on their way out of the kernel tree.
> An indication for drivers being unused is that they have been marked broken
> or obsolete for a loooong time; and then they'll remain in staging for 3
> releases or so before being removed (or being moved in again).

Is the 3 releases a fixed date? Got a couple of drivers in there
that I "might" want to use in the near future. Just havent had time to
looking at cleaning them up.

> 
> Best,
> 	Dominik
> 
> _______________________________________________
> Linux PCMCIA reimplementation list
> http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Komuro Nov. 7, 2009, 10:33 p.m. UTC | #13
Hi,


At least, we need to add one line below to pcmciamtd.c .

   PCMCIA_DEVICE_PROD_ID12("PRETEC", "  2MB SRAM CARD", 0xebf91155, 0x805360ca
),

>Hey,
>
>it seems that just as we were preparing to move pcmciamtd to staging, an
>user who still tries to use it has appeared:
>
>> ATTR{modalias}=="pcmcia:m0000c0000f00fn00pfn00paEBF91155pb805360CApc0000000
0pd00000000"
>> ? ? ATTR{prod_id2}==" ?2MB SRAM CARD"
>> ? ? ATTR{prod_id1}=="PRETEC"
>> ? ? ATTR{pm_state}=="on"
>> ? ? ATTR{function}=="0x00"
>
>So, what is actually BROKEN with pcmciamtd.c ?
>
>Best,
>	Dominik
>
>_______________________________________________
>Linux PCMCIA reimplementation list
>http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Dominik Brodowski Nov. 8, 2009, 8:12 a.m. UTC | #14
Hey,

On Sat, Nov 07, 2009 at 05:57:51PM +0100, Kristoffer Ericson wrote:
> On Sat, 7 Nov 2009 12:33:46 +0100
> Dominik Brodowski <linux@dominikbrodowski.net> wrote:
> > On Sat, Nov 07, 2009 at 08:29:09PM +0900, Komuro wrote:
> > > staging directory is not the place for broken driver,
> > > is it?
> > 
> > 
> > It is becoming the place for drivers on their way out of the kernel tree.
> > An indication for drivers being unused is that they have been marked broken
> > or obsolete for a loooong time; and then they'll remain in staging for 3
> > releases or so before being removed (or being moved in again).
> 
> Is the 3 releases a fixed date? Got a couple of drivers in there
> that I "might" want to use in the near future. Just havent had time to
> looking at cleaning them up.

IIRC it's 3 releases of inaction before there's the intention to remove the
drivers. But for the details of these rules (which probably aren't black and
white) you should ask the maintainer of linux-staging :)

Best,
	Dominik
diff mbox

Patch

diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index 52c07f2..fa00919 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -119,10 +119,8 @@  static caddr_t remap_window(struct map_info *map, unsigned long to)
 		      dev->offset, mrq.CardOffset);
 		mrq.Page = 0;
 		ret = pcmcia_map_mem_page(win, &mrq);
-		if (ret != 0) {
-			cs_error(dev->p_dev, MapMemPage, ret);
+		if (ret != 0)
 			return NULL;
-		}
 		dev->offset = mrq.CardOffset;
 	}
 	return dev->win_base + (to & (dev->win_size-1));
@@ -327,8 +325,6 @@  static void pcmciamtd_set_vpp(struct map_info *map, int on)
 
 	DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
 	ret = pcmcia_modify_configuration(link, &mod);
-	if (ret != 0)
-		cs_error(link, ModifyConfiguration, ret);
 }
 
 
@@ -488,16 +484,12 @@  static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
  * MTD device available to the system.
  */
 
-#define CS_CHECK(fn, ret) \
-do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-
 static int pcmciamtd_config(struct pcmcia_device *link)
 {
 	struct pcmciamtd_dev *dev = link->priv;
 	struct mtd_info *mtd = NULL;
 	cs_status_t status;
 	win_req_t req;
-	int last_ret = 0, last_fn = 0;
 	int ret;
 	int i;
 	static char *probes[] = { "jedec_probe", "cfi_probe" };
@@ -584,7 +576,6 @@  static int pcmciamtd_config(struct pcmcia_device *link)
 	DEBUG(2, "Setting Configuration");
 	ret = pcmcia_request_configuration(link, &link->conf);
 	if (ret != 0) {
-		cs_error(link, RequestConfiguration, ret);
 		if (dev->win_base) {
 			iounmap(dev->win_base);
 			dev->win_base = NULL;
@@ -659,8 +650,7 @@  static int pcmciamtd_config(struct pcmcia_device *link)
 	link->dev_node = &dev->node;
 	return 0;
 
- cs_failed:
-	cs_error(link, last_fn, last_ret);
+ failed:
 	err("CS Error, exiting");
 	pcmciamtd_release(link);
 	return -ENODEV;
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 8fdfa4f..e56a4de 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -67,14 +67,6 @@  MODULE_LICENSE("Dual MPL/GPL");
 
 INT_MODULE_PARM(epp_mode, 1);
 
-#ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-static char *version =
-"parport_cs.c 1.29 2002/10/11 06:57:41 (David Hinds)";
-#else
-#define DEBUG(n, args...)
-#endif
 
 /*====================================================================*/
 
@@ -103,7 +95,7 @@  static int parport_probe(struct pcmcia_device *link)
 {
     parport_info_t *info;
 
-    DEBUG(0, "parport_attach()\n");
+    dev_dbg(&link->dev, "parport_attach()\n");
 
     /* Create new parport device */
     info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -132,7 +124,7 @@  static int parport_probe(struct pcmcia_device *link)
 
 static void parport_detach(struct pcmcia_device *link)
 {
-    DEBUG(0, "parport_detach(0x%p)\n", link);
+    dev_dbg(&link->dev, "parport_detach\n");
 
     parport_cs_release(link);
 
@@ -147,9 +139,6 @@  static void parport_detach(struct pcmcia_device *link)
 
 ======================================================================*/
 
-#define CS_CHECK(fn, ret) \
-do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-
 static int parport_config_check(struct pcmcia_device *p_dev,
 				cistpl_cftable_entry_t *cfg,
 				cistpl_cftable_entry_t *dflt,
@@ -178,18 +167,20 @@  static int parport_config(struct pcmcia_device *link)
 {
     parport_info_t *info = link->priv;
     struct parport *p;
-    int last_ret, last_fn;
+    int ret;
 
-    DEBUG(0, "parport_config(0x%p)\n", link);
+    dev_dbg(&link->dev, "parport_config\n");
 
-    last_ret = pcmcia_loop_config(link, parport_config_check, NULL);
-    if (last_ret) {
-	    cs_error(link, RequestIO, last_ret);
+    ret = pcmcia_loop_config(link, parport_config_check, NULL);
+    if (ret)
 	    goto failed;
-    }
 
-    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;
 
     p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2,
 			      link->irq.AssignedIRQ, PARPORT_DMA_NONE,
@@ -213,8 +204,6 @@  static int parport_config(struct pcmcia_device *link)
 
     return 0;
 
-cs_failed:
-    cs_error(link, last_fn, last_ret);
 failed:
     parport_cs_release(link);
     return -ENODEV;
@@ -232,7 +221,7 @@  static void parport_cs_release(struct pcmcia_device *link)
 {
 	parport_info_t *info = link->priv;
 
-	DEBUG(0, "parport_release(0x%p)\n", link);
+	dev_dbg(&link->dev, "parport_release\n");
 
 	if (info->ndev) {
 		struct parport *p = info->port;
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index 347c3ed..86f2767 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -19,13 +19,6 @@ 
  *	PCMCIA service support for Quicknet cards
  */
  
-#ifdef PCMCIA_DEBUG
-static int pc_debug = PCMCIA_DEBUG;
-module_param(pc_debug, int, 0644);
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-#else
-#define DEBUG(n, args...)
-#endif
 
 typedef struct ixj_info_t {
 	int ndev;
@@ -39,7 +32,7 @@  static void ixj_cs_release(struct pcmcia_device * link);
 
 static int ixj_probe(struct pcmcia_device *p_dev)
 {
-	DEBUG(0, "ixj_attach()\n");
+	dev_dbg(&link->dev, "ixj_attach()\n");
 	/* Create new ixj device */
 	p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
 	p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
@@ -55,33 +48,30 @@  static int ixj_probe(struct pcmcia_device *p_dev)
 
 static void ixj_detach(struct pcmcia_device *link)
 {
-	DEBUG(0, "ixj_detach(0x%p)\n", link);
+	dev_dbg(&link->dev, "ixj_detach\n");
 
 	ixj_cs_release(link);
 
         kfree(link->priv);
 }
 
-#define CS_CHECK(fn, ret) \
-do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-
 static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
 {
 	char *str;
 	int i, place;
-	DEBUG(0, "ixj_get_serial(0x%p)\n", link);
+	dev_dbg(&link->dev, "ixj_get_serial\n");
 
 	str = link->prod_id[0];
 	if (!str)
-		goto cs_failed;
+		goto failed;
 	printk("%s", str);
 	str = link->prod_id[1];
 	if (!str)
-		goto cs_failed;
+		goto failed;
 	printk(" %s", str);
 	str = link->prod_id[2];
 	if (!str)
-		goto cs_failed;
+		goto failed;
 	place = 1;
 	for (i = strlen(str) - 1; i >= 0; i--) {
 		switch (str[i]) {
@@ -118,9 +108,9 @@  static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
 	}
 	str = link->prod_id[3];
 	if (!str)
-		goto cs_failed;
+		goto failed;
 	printk(" version %s\n", str);
-      cs_failed:
+      failed:
 	return;
 }
 
@@ -151,13 +141,13 @@  static int ixj_config(struct pcmcia_device * link)
 	cistpl_cftable_entry_t dflt = { 0 };
 
 	info = link->priv;
-	DEBUG(0, "ixj_config(0x%p)\n", link);
+	dev_dbg(&link->dev, "ixj_config\n");
 
 	if (pcmcia_loop_config(link, ixj_config_check, &dflt))
-		goto cs_failed;
+		goto failed;
 
 	if (pcmcia_request_configuration(link, &link->conf))
-		goto cs_failed;
+		goto failed;
 
 	/*
  	 *	Register the card with the core.
@@ -170,7 +160,7 @@  static int ixj_config(struct pcmcia_device * link)
 	ixj_get_serial(link, j);
 	return 0;
 
-      cs_failed:
+      failed:
 	ixj_cs_release(link);
 	return -ENODEV;
 }
@@ -178,7 +168,7 @@  static int ixj_config(struct pcmcia_device * link)
 static void ixj_cs_release(struct pcmcia_device *link)
 {
 	ixj_info_t *info = link->priv;
-	DEBUG(0, "ixj_cs_release(0x%p)\n", link);
+	dev_dbg(&link->dev, "ixj_cs_release\n");
 	info->ndev = 0;
 	pcmcia_disable_device(link);
 }
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 516848d..4607742 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -37,28 +37,8 @@  MODULE_LICENSE("GPL");
 /* MACROS                                                             */
 /*====================================================================*/
 
-#if defined(DEBUG) || defined(PCMCIA_DEBUG)
-
-static int pc_debug = 0;
-module_param(pc_debug, int, 0644);
-
-#define DBG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG "sl811_cs: " args)
-
-#else
-#define DBG(n, args...) do{}while(0)
-#endif	/* no debugging */
-
 #define INFO(args...) printk(KERN_INFO "sl811_cs: " args)
 
-#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
-
-#define CS_CHECK(fn, ret) \
-	do { \
-		last_fn = (fn); \
-		if ((last_ret = (ret)) != 0) \
-			goto cs_failed; \
-	} while (0)
-
 /*====================================================================*/
 /* VARIABLES                                                          */
 /*====================================================================*/
@@ -76,7 +56,7 @@  static void sl811_cs_release(struct pcmcia_device * link);
 
 static void release_platform_dev(struct device * dev)
 {
-	DBG(0, "sl811_cs platform_dev release\n");
+	dev_dbg(dev, "sl811_cs platform_dev release\n");
 	dev->parent = NULL;
 }
 
@@ -140,7 +120,7 @@  static int sl811_hc_init(struct device *parent, resource_size_t base_addr,
 
 static void sl811_cs_detach(struct pcmcia_device *link)
 {
-	DBG(0, "sl811_cs_detach(0x%p)\n", link);
+	dev_dbg(&link->dev, "sl811_cs_detach\n");
 
 	sl811_cs_release(link);
 
@@ -150,7 +130,7 @@  static void sl811_cs_detach(struct pcmcia_device *link)
 
 static void sl811_cs_release(struct pcmcia_device * link)
 {
-	DBG(0, "sl811_cs_release(0x%p)\n", link);
+	dev_dbg(&link->dev, "sl811_cs_release\n");
 
 	pcmcia_disable_device(link);
 	platform_device_unregister(&platform_dev);
@@ -207,9 +187,9 @@  static int sl811_cs_config(struct pcmcia_device *link)
 {
 	struct device		*parent = &handle_to_dev(link);
 	local_info_t		*dev = link->priv;
-	int			last_fn, last_ret;
+	int			ret;
 
-	DBG(0, "sl811_cs_config(0x%p)\n", link);
+	dev_dbg(&link->dev, "sl811_cs_config\n");
 
 	if (pcmcia_loop_config(link, sl811_cs_config_check, NULL))
 		goto failed;
@@ -217,14 +197,16 @@  static int sl811_cs_config(struct pcmcia_device *link)
 	/* require an IRQ and two registers */
 	if (!link->io.NumPorts1 || link->io.NumPorts1 < 2)
 		goto failed;
-	if (link->conf.Attributes & CONF_ENABLE_IRQ)
-		CS_CHECK(RequestIRQ,
-			pcmcia_request_irq(link, &link->irq));
-	else
+	if (link->conf.Attributes & CONF_ENABLE_IRQ) {
+		ret = pcmcia_request_irq(link, &link->irq);
+		if (ret)
+			goto failed;
+	} else
 		goto failed;
 
-	CS_CHECK(RequestConfiguration,
-		pcmcia_request_configuration(link, &link->conf));
+	ret = pcmcia_request_configuration(link, &link->conf);
+	if (ret)
+		goto failed;
 
 	sprintf(dev->node.dev_name, driver_name);
 	dev->node.major = dev->node.minor = 0;
@@ -241,8 +223,6 @@  static int sl811_cs_config(struct pcmcia_device *link)
 
 	if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ)
 			< 0) {
-cs_failed:
-		cs_error(link, last_fn, last_ret);
 failed:
 		printk(KERN_WARNING "sl811_cs_config failed\n");
 		sl811_cs_release(link);