Netdev List
 help / color / mirror / Atom feed
* Re: 2.6.16, sk98lin out of date
From: Lee Revell @ 2006-02-13 20:40 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: Mws, Alistair John Strachan, linux-kernel, netdev
In-Reply-To: <20060213203434.GI11380@w.ods.org>

On Mon, 2006-02-13 at 21:34 +0100, Willy Tarreau wrote:
> On Mon, Feb 13, 2006 at 02:03:14PM -0500, Lee Revell wrote:
> > On Mon, 2006-02-13 at 12:06 +0100, Mws wrote:
> > > hi,
> > > as i do have the same problem i may help you out.
> > > 
> > > at first, syskonnect did send their kernel diffs/patches but they
> > > we're rejected caused
> > > by coding style, indention and some people thinking that things can be
> > > done better. 
> > 
> > Haha, they didn't like the LKML code review so they just stopped sending
> > patches?  Classic.  Remind me not to buy their gear.
> 
> Lee, it's not always that simple. When you submit one driver, sometimes
> reviewers tell you that for whatever reason your driver's structure is
> wrong and it has to be changed a lot (and sometimes they're right of
> course). But when you don't have enough ressource to do the job twice,
> the best you can do is to maintain it out of tree, which is already a
> pain. I'm not saying that it is what happened with their driver, I don't
> know the history. However, I found your reaction somewhat hasty. I
> personally would prefer to offer time and help before deciding that
> I don't want anyone's products on this basis. It's not as if they
> did not release their driver's source!

True, that was a little harsh.  I just find it a little sad that all
these vendors insist on throwing away months of work rather than simply
researching what the linux kernel coding standards are ahead of time.

Lee

^ permalink raw reply

* Re: [PATCH 0/7] IrDA updates
From: Samuel Ortiz @ 2006-02-13 22:14 UTC (permalink / raw)
  To: ext David S. Miller
  Cc: IrDA users, Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20060209.170448.122642050.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

On Thu, Feb 09, 2006 at 05:04:48PM -0800, ext David S. Miller wrote:
> Something in your email client corrupts the patches.  For one
> thing, it turns lines with just spaces in them into empty lines.
> I've seen this transformation before, in patches from other
> people.
> 
> So please try to send patches 1, 2, 3, 5, and 6 to yourself until
> the emails you send out give clean applyable patches.
I have changed my email client and sent the patches to some other people and myself. Everything seems to be ok.

So, I will now send the remaining 5 patches.

Hopefully it will work for you as well.

Cheers,
Samuel.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

^ permalink raw reply

* [PATCH 1/5] IrDA: nsc-ircc: ISAPnP support
From: Samuel Ortiz @ 2006-02-13 22:14 UTC (permalink / raw)
  To: ext David S. Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Jean Tourrilhes, IrDA users

This enables PnP support for the nsc-ircc chipset.
Since we can't fetch the chipset cfg_base from the PnP layer, we just use
the PnP information as one more hint when probing the chip.

Signed-off-by: Jean Tourrilhes <jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org> 
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> 

diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index ee717d0..74cb38c 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -12,6 +12,7 @@
  *     Copyright (c) 1998-2000 Dag Brattli <dagb-WiQn+q4tdXRhl2p70BpVqQ@public.gmane.org>
  *     Copyright (c) 1998 Lichen Wang, <lwang-df/MbWHcLfRBDgjK7y7TUQ@public.gmane.org>
  *     Copyright (c) 1998 Actisys Corp., www.actisys.com
+ *     Copyright (c) 2000-2004 Jean Tourrilhes <jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org>
  *     All Rights Reserved
  *      
  *     This program is free software; you can redistribute it and/or 
@@ -53,6 +54,7 @@
 #include <linux/init.h>
 #include <linux/rtnetlink.h>
 #include <linux/dma-mapping.h>
+#include <linux/pnp.h>
 
 #include <asm/io.h>
 #include <asm/dma.h>
@@ -78,8 +80,8 @@ static int dongle_id;
 
 /* Use BIOS settions by default, but user may supply module parameters */
 static unsigned int io[]  = { ~0, ~0, ~0, ~0 };
-static unsigned int irq[] = { 0, 0, 0, 0, 0 };
-static unsigned int dma[] = { 0, 0, 0, 0, 0 };
+static unsigned int irq[] = {  0,  0,  0,  0 };
+static unsigned int dma[] = {  0,  0,  0,  0 };
 
 static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info);
 static int nsc_ircc_probe_338(nsc_chip_t *chip, chipio_t *info);
@@ -87,6 +89,7 @@ static int nsc_ircc_probe_39x(nsc_chip_t
 static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info);
 static int nsc_ircc_init_338(nsc_chip_t *chip, chipio_t *info);
 static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info);
+static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id);
 
 /* These are the known NSC chips */
 static nsc_chip_t chips[] = {
@@ -104,7 +107,6 @@ static nsc_chip_t chips[] = {
 	{ NULL }
 };
 
-/* Max 4 instances for now */
 static struct nsc_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL };
 
 static char *dongle_types[] = {
@@ -126,8 +128,24 @@ static char *dongle_types[] = {
 	"No dongle connected",
 };
 
+/* PNP probing */
+static chipio_t pnp_info;
+static const struct pnp_device_id nsc_ircc_pnp_table[] = {
+	{ .id = "NSC6001", .driver_data = 0 },
+	{ .id = "IBM0071", .driver_data = 0 },
+	{ }
+};
+
+MODULE_DEVICE_TABLE(pnp, nsc_ircc_pnp_table);
+
+static struct pnp_driver nsc_ircc_pnp_driver = {
+	.name = "nsc-ircc",
+	.id_table = nsc_ircc_pnp_table,
+	.probe = nsc_ircc_pnp_probe,
+};
+
 /* Some prototypes */
-static int  nsc_ircc_open(int i, chipio_t *info);
+static int  nsc_ircc_open(chipio_t *info);
 static int  nsc_ircc_close(struct nsc_ircc_cb *self);
 static int  nsc_ircc_setup(chipio_t *info);
 static void nsc_ircc_pio_receive(struct nsc_ircc_cb *self);
@@ -148,6 +166,10 @@ static int  nsc_ircc_net_ioctl(struct ne
 static struct net_device_stats *nsc_ircc_net_get_stats(struct net_device *dev);
 static int nsc_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data);
 
+/* Globals */
+static int pnp_registered;
+static int pnp_succeeded;
+
 /*
  * Function nsc_ircc_init ()
  *
@@ -158,28 +180,30 @@ static int __init nsc_ircc_init(void)
 {
 	chipio_t info;
 	nsc_chip_t *chip;
-	int ret = -ENODEV;
+	int ret;
 	int cfg_base;
 	int cfg, id;
 	int reg;
 	int i = 0;
 
+ 	/* Register with PnP subsystem to detect disable ports */
+	ret = pnp_register_driver(&nsc_ircc_pnp_driver);
+
+ 	if (ret >= 0)
+ 		pnp_registered = 1;
+
+	ret = -ENODEV;
+
 	/* Probe for all the NSC chipsets we know about */
-	for (chip=chips; chip->name ; chip++) {
+	for (chip = chips; chip->name ; chip++) {
 		IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __FUNCTION__,
 			   chip->name);
 		
 		/* Try all config registers for this chip */
-		for (cfg=0; cfg<3; cfg++) {
+		for (cfg = 0; cfg < ARRAY_SIZE(chip->cfg); cfg++) {
 			cfg_base = chip->cfg[cfg];
 			if (!cfg_base)
 				continue;
-			
-			memset(&info, 0, sizeof(chipio_t));
-			info.cfg_base = cfg_base;
-			info.fir_base = io[i];
-			info.dma = dma[i];
-			info.irq = irq[i];
 
 			/* Read index register */
 			reg = inb(cfg_base);
@@ -194,26 +218,66 @@ static int __init nsc_ircc_init(void)
 			if ((id & chip->cid_mask) == chip->cid_value) {
 				IRDA_DEBUG(2, "%s() Found %s chip, revision=%d\n",
 					   __FUNCTION__, chip->name, id & ~chip->cid_mask);
-				/* 
-				 * If the user supplies the base address, then
-				 * we init the chip, if not we probe the values
-				 * set by the BIOS
-				 */				
-				if (io[i] < 0x2000) {
-					chip->init(chip, &info);
-				} else
-					chip->probe(chip, &info);
-
-				if (nsc_ircc_open(i, &info) == 0)
-					ret = 0;
+				
+				/*
+				 * If we found a correct PnP setting, 
+				 * we first try it.
+				 */
+				if (pnp_succeeded) {
+					memset(&info, 0, sizeof(chipio_t));
+					info.cfg_base = cfg_base;
+					info.fir_base = pnp_info.fir_base;
+					info.dma = pnp_info.dma;
+					info.irq = pnp_info.irq;
+					
+					if (info.fir_base < 0x2000) {
+						IRDA_MESSAGE("%s, chip->init\n", driver_name);
+						chip->init(chip, &info);
+					} else
+						chip->probe(chip, &info);
+					
+					if (nsc_ircc_open(&info) >= 0)
+						ret = 0;
+				}
+				
+				/*
+				 * Opening based on PnP values failed.
+				 * Let's fallback to user values, or probe
+				 * the chip.
+				 */
+				if (ret) {
+					IRDA_DEBUG(2, "%s, PnP init failed\n", driver_name);
+					memset(&info, 0, sizeof(chipio_t));
+					info.cfg_base = cfg_base;
+					info.fir_base = io[i];
+					info.dma = dma[i];
+					info.irq = irq[i];
+		
+					/* 
+					 * If the user supplies the base address, then
+					 * we init the chip, if not we probe the values
+					 * set by the BIOS
+					 */				
+					if (io[i] < 0x2000) {
+						chip->init(chip, &info);
+					} else
+						chip->probe(chip, &info);
+					
+					if (nsc_ircc_open(&info) >= 0)
+						ret = 0;
+				}				
 				i++;
 			} else {
 				IRDA_DEBUG(2, "%s(), Wrong chip id=0x%02x\n", __FUNCTION__, id);
 			}
 		} 
-		
 	}
 
+	if (ret) {
+		pnp_unregister_driver(&nsc_ircc_pnp_driver);
+		pnp_registered = 0;
+	}
+		
 	return ret;
 }
 
@@ -228,11 +292,16 @@ static void __exit nsc_ircc_cleanup(void
 	int i;
 
 	pm_unregister_all(nsc_ircc_pmproc);
-
-	for (i=0; i < 4; i++) {
+	
+	for (i = 0; i < ARRAY_SIZE(dev_self); i++) {
 		if (dev_self[i])
 			nsc_ircc_close(dev_self[i]);
 	}
+
+	if (pnp_registered)
+ 		pnp_unregister_driver(&nsc_ircc_pnp_driver);
+	
+	pnp_registered = 0;
 }
 
 /*
@@ -241,16 +310,27 @@ static void __exit nsc_ircc_cleanup(void
  *    Open driver instance
  *
  */
-static int __init nsc_ircc_open(int i, chipio_t *info)
+static int __init nsc_ircc_open(chipio_t *info)
 {
 	struct net_device *dev;
 	struct nsc_ircc_cb *self;
-        struct pm_dev *pmdev;
+	struct pm_dev *pmdev;
 	void *ret;
-	int err;
+	int err, chip_index;
 
 	IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
 
+
+ 	for (chip_index = 0; chip_index < ARRAY_SIZE(dev_self); chip_index++) {
+		if (!dev_self[chip_index])
+			break;
+	}
+	
+	if (chip_index == ARRAY_SIZE(dev_self)) {
+		IRDA_ERROR("%s(), maximum number of supported chips reached!\n", __FUNCTION__);
+		return -ENOMEM;
+	}
+
 	IRDA_MESSAGE("%s, Found chip at base=0x%03x\n", driver_name,
 		     info->cfg_base);
 
@@ -271,8 +351,8 @@ static int __init nsc_ircc_open(int i, c
 	spin_lock_init(&self->lock);
    
 	/* Need to store self somewhere */
-	dev_self[i] = self;
-	self->index = i;
+	dev_self[chip_index] = self;
+	self->index = chip_index;
 
 	/* Initialize IO */
 	self->io.cfg_base  = info->cfg_base;
@@ -351,7 +431,7 @@ static int __init nsc_ircc_open(int i, c
 
 	/* Check if user has supplied a valid dongle id or not */
 	if ((dongle_id <= 0) ||
-	    (dongle_id >= (sizeof(dongle_types) / sizeof(dongle_types[0]))) ) {
+	    (dongle_id >= ARRAY_SIZE(dongle_types))) {
 		dongle_id = nsc_ircc_read_dongle_id(self->io.fir_base);
 		
 		IRDA_MESSAGE("%s, Found dongle: %s\n", driver_name,
@@ -368,7 +448,7 @@ static int __init nsc_ircc_open(int i, c
         if (pmdev)
                 pmdev->data = self;
 
-	return 0;
+	return chip_index;
  out4:
 	dma_free_coherent(NULL, self->tx_buff.truesize,
 			  self->tx_buff.head, self->tx_buff_dma);
@@ -379,7 +459,7 @@ static int __init nsc_ircc_open(int i, c
 	release_region(self->io.fir_base, self->io.fir_ext);
  out1:
 	free_netdev(dev);
-	dev_self[i] = NULL;
+	dev_self[chip_index] = NULL;
 	return err;
 }
 
@@ -806,6 +886,43 @@ static int nsc_ircc_probe_39x(nsc_chip_t
 	return 0;
 }
 
+/* PNP probing */
+static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id)
+{
+	memset(&pnp_info, 0, sizeof(chipio_t));
+	pnp_info.irq = -1;
+	pnp_info.dma = -1;
+	pnp_succeeded = 1;
+
+	/* There don't seem to be any way to get the cfg_base.
+	 * On my box, cfg_base is in the PnP descriptor of the
+	 * motherboard. Oh well... Jean II */
+
+	if (pnp_port_valid(dev, 0) &&
+		!(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED))
+		pnp_info.fir_base = pnp_port_start(dev, 0);
+
+	if (pnp_irq_valid(dev, 0) &&
+		!(pnp_irq_flags(dev, 0) & IORESOURCE_DISABLED))
+		pnp_info.irq = pnp_irq(dev, 0);
+
+	if (pnp_dma_valid(dev, 0) &&
+		!(pnp_dma_flags(dev, 0) & IORESOURCE_DISABLED))
+		pnp_info.dma = pnp_dma(dev, 0);
+
+	IRDA_DEBUG(0, "%s() : From PnP, found firbase 0x%03X ; irq %d ; dma %d.\n",
+		   __FUNCTION__, pnp_info.fir_base, pnp_info.irq, pnp_info.dma);
+	
+	if((pnp_info.fir_base == 0) ||
+	   (pnp_info.irq == -1) || (pnp_info.dma == -1)) {
+		/* Returning an error will disable the device. Yuck ! */
+		//return -EINVAL;
+		pnp_succeeded = 0;
+	}
+
+	return 0;
+}
+
 /*
  * Function nsc_ircc_setup (info)
  *


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

^ permalink raw reply related

* [PATCH 2/5] IrDA: nsc-ircc: PM update
From: Samuel Ortiz @ 2006-02-13 22:15 UTC (permalink / raw)
  To: ext David S. Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Jean Tourrilhes, IrDA users

This patch brings the nsc-ircc code to a more up to date power management
scheme, following the current device model.

Signed-off-by: Dmitry Torokhov <dtor-JGs/UdohzUI@public.gmane.org>
Signed-off-by: Rudolf Marek <r.marek-3zVPrsR01WjrBKCeMvbIDA@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index 6edf7e5..dacf671 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -269,7 +269,7 @@ struct nsc_ircc_cb {
 	__u32 new_speed;
 	int index;                 /* Instance index */
 
-        struct pm_dev *dev;
+	struct platform_device *pldev;
 };
 
 static inline void switch_bank(int iobase, int bank)
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index 74cb38c..e8ff07f 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -55,14 +55,12 @@
 #include <linux/rtnetlink.h>
 #include <linux/dma-mapping.h>
 #include <linux/pnp.h>
+#include <linux/platform_device.h>
 
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/byteorder.h>
 
-#include <linux/pm.h>
-#include <linux/pm_legacy.h>
-
 #include <net/irda/wrapper.h>
 #include <net/irda/irda.h>
 #include <net/irda/irda_device.h>
@@ -74,6 +72,19 @@
 
 static char *driver_name = "nsc-ircc";
 
+/* Power Management */
+#define NSC_IRCC_DRIVER_NAME                  "nsc-ircc"
+static int nsc_ircc_suspend(struct platform_device *dev, pm_message_t state);
+static int nsc_ircc_resume(struct platform_device *dev);
+
+static struct platform_driver nsc_ircc_driver = {
+	.suspend	= nsc_ircc_suspend,
+	.resume		= nsc_ircc_resume,
+	.driver		= {
+		.name	= NSC_IRCC_DRIVER_NAME,
+	},
+};
+
 /* Module parameters */
 static int qos_mtt_bits = 0x07;  /* 1 ms or more */
 static int dongle_id;
@@ -164,7 +175,6 @@ static int  nsc_ircc_net_open(struct net
 static int  nsc_ircc_net_close(struct net_device *dev);
 static int  nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static struct net_device_stats *nsc_ircc_net_get_stats(struct net_device *dev);
-static int nsc_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data);
 
 /* Globals */
 static int pnp_registered;
@@ -186,6 +196,12 @@ static int __init nsc_ircc_init(void)
 	int reg;
 	int i = 0;
 
+	ret = platform_driver_register(&nsc_ircc_driver); 
+        if (ret) {
+                IRDA_ERROR("%s, Can't register driver!\n", driver_name);       
+                return ret;                                                                       
+        }	
+
  	/* Register with PnP subsystem to detect disable ports */
 	ret = pnp_register_driver(&nsc_ircc_pnp_driver);
 
@@ -274,6 +290,7 @@ static int __init nsc_ircc_init(void)
 	}
 
 	if (ret) {
+		platform_driver_unregister(&nsc_ircc_driver);
 		pnp_unregister_driver(&nsc_ircc_pnp_driver);
 		pnp_registered = 0;
 	}
@@ -291,13 +308,13 @@ static void __exit nsc_ircc_cleanup(void
 {
 	int i;
 
-	pm_unregister_all(nsc_ircc_pmproc);
-	
 	for (i = 0; i < ARRAY_SIZE(dev_self); i++) {
 		if (dev_self[i])
 			nsc_ircc_close(dev_self[i]);
 	}
 
+	platform_driver_unregister(&nsc_ircc_driver);
+
 	if (pnp_registered)
  		pnp_unregister_driver(&nsc_ircc_pnp_driver);
 	
@@ -314,7 +331,6 @@ static int __init nsc_ircc_open(chipio_t
 {
 	struct net_device *dev;
 	struct nsc_ircc_cb *self;
-	struct pm_dev *pmdev;
 	void *ret;
 	int err, chip_index;
 
@@ -444,11 +460,18 @@ static int __init nsc_ircc_open(chipio_t
 	self->io.dongle_id = dongle_id;
 	nsc_ircc_init_dongle_interface(self->io.fir_base, dongle_id);
 
-        pmdev = pm_register(PM_SYS_DEV, PM_SYS_IRDA, nsc_ircc_pmproc);
-        if (pmdev)
-                pmdev->data = self;
+ 	self->pldev = platform_device_register_simple(NSC_IRCC_DRIVER_NAME,
+ 						      self->index, NULL, 0);
+ 	if (IS_ERR(self->pldev)) {
+ 		err = PTR_ERR(self->pldev);
+ 		goto out5;
+ 	}
+ 	platform_set_drvdata(self->pldev, self);
 
 	return chip_index;
+
+ out5: 
+ 	unregister_netdev(dev);
  out4:
 	dma_free_coherent(NULL, self->tx_buff.truesize,
 			  self->tx_buff.head, self->tx_buff_dma);
@@ -479,6 +502,8 @@ static int __exit nsc_ircc_close(struct 
 
         iobase = self->io.fir_base;
 
+	platform_device_unregister(self->pldev);
+
 	/* Remove netdevice */
 	unregister_netdev(self->netdev);
 
@@ -2278,45 +2303,83 @@ static struct net_device_stats *nsc_ircc
 	return &self->stats;
 }
 
-static void nsc_ircc_suspend(struct nsc_ircc_cb *self)
+static int nsc_ircc_suspend(struct platform_device *dev, pm_message_t state)
 {
-	IRDA_MESSAGE("%s, Suspending\n", driver_name);
-
+     	struct nsc_ircc_cb *self = platform_get_drvdata(dev);
+ 	int bank;
+	unsigned long flags;
+ 	int iobase = self->io.fir_base;
+	
 	if (self->io.suspended)
-		return;
-
-	nsc_ircc_net_close(self->netdev);
+		return 0;
 
+	IRDA_DEBUG(1, "%s, Suspending\n", driver_name);
+		
+	rtnl_lock();
+	if (netif_running(self->netdev)) {
+		netif_device_detach(self->netdev);
+		spin_lock_irqsave(&self->lock, flags);
+		/* Save current bank */
+		bank = inb(iobase+BSR);
+		
+		/* Disable interrupts */
+		switch_bank(iobase, BANK0);
+		outb(0, iobase+IER);
+		
+		/* Restore bank register */
+		outb(bank, iobase+BSR);
+		
+		spin_unlock_irqrestore(&self->lock, flags);
+		free_irq(self->io.irq, self->netdev);
+		disable_dma(self->io.dma);
+	}
 	self->io.suspended = 1;
+	rtnl_unlock();
+ 	
+	return 0;
 }
-
-static void nsc_ircc_wakeup(struct nsc_ircc_cb *self)
+ 
+static int nsc_ircc_resume(struct platform_device *dev)
 {
+ 	struct nsc_ircc_cb *self = platform_get_drvdata(dev);
+ 	unsigned long flags;
+ 
 	if (!self->io.suspended)
-		return;
+		return 0;
+
+	IRDA_DEBUG(1, "%s, Waking up\n", driver_name);
 
+	rtnl_lock();
 	nsc_ircc_setup(&self->io);
-	nsc_ircc_net_open(self->netdev);
-	
-	IRDA_MESSAGE("%s, Waking up\n", driver_name);
+	nsc_ircc_init_dongle_interface(self->io.fir_base, self->io.dongle_id);
 
+	if (netif_running(self->netdev)) {
+		if (request_irq(self->io.irq, nsc_ircc_interrupt, 0,                     				
+				self->netdev->name, self->netdev)) {
+ 		    	IRDA_WARNING("%s, unable to allocate irq=%d\n",
+				     driver_name, self->io.irq);
+			
+			/*
+			 * Don't fail resume process, just kill this
+			 * network interface
+			 */
+			unregister_netdevice(self->netdev);
+		} else {
+			spin_lock_irqsave(&self->lock, flags);
+			nsc_ircc_change_speed(self, self->io.speed);
+			spin_unlock_irqrestore(&self->lock, flags);
+			netif_device_attach(self->netdev);
+		}
+		
+	} else {
+		spin_lock_irqsave(&self->lock, flags);
+		nsc_ircc_change_speed(self, 9600);
+		spin_unlock_irqrestore(&self->lock, flags);
+	}
 	self->io.suspended = 0;
-}
+	rtnl_unlock();
 
-static int nsc_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data)
-{
-        struct nsc_ircc_cb *self = (struct nsc_ircc_cb*) dev->data;
-        if (self) {
-                switch (rqst) {
-                case PM_SUSPEND:
-                        nsc_ircc_suspend(self);
-                        break;
-                case PM_RESUME:
-                        nsc_ircc_wakeup(self);
-                        break;
-                }
-        }
-	return 0;
+ 	return 0;
 }
 
 MODULE_AUTHOR("Dag Brattli <dagb-WiQn+q4tdXRhl2p70BpVqQ@public.gmane.org>");


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

^ permalink raw reply related

* [PATCH 3/5] IrDA: nsc-ircc: support for yet another Thinkpad IrDA chipset
From: Samuel Ortiz @ 2006-02-13 22:15 UTC (permalink / raw)
  To: ext David S. Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Jean Tourrilhes, IrDA users

This patch simply adds support for a variation of the nsc-ircc PC8739x
chipset, found in some IBM Thinkpad laptops.

Signed-off-by: Jean Tourrilhes <jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org> 
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> 

diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index e8ff07f..39cf5f0 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -90,9 +90,9 @@ static int qos_mtt_bits = 0x07;  /* 1 ms
 static int dongle_id;
 
 /* Use BIOS settions by default, but user may supply module parameters */
-static unsigned int io[]  = { ~0, ~0, ~0, ~0 };
-static unsigned int irq[] = {  0,  0,  0,  0 };
-static unsigned int dma[] = {  0,  0,  0,  0 };
+static unsigned int io[]  = { ~0, ~0, ~0, ~0, ~0 };
+static unsigned int irq[] = {  0,  0,  0,  0,  0 };
+static unsigned int dma[] = {  0,  0,  0,  0,  0 };
 
 static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info);
 static int nsc_ircc_probe_338(nsc_chip_t *chip, chipio_t *info);
@@ -115,10 +115,12 @@ static nsc_chip_t chips[] = {
 	/* Contributed by Jan Frey - IBM A30/A31 */
 	{ "PC8739x", { 0x2e, 0x4e, 0x0 }, 0x20, 0xea, 0xff, 
 	  nsc_ircc_probe_39x, nsc_ircc_init_39x },
+	{ "IBM", { 0x2e, 0x4e, 0x0 }, 0x20, 0xf4, 0xff,
+ 	  nsc_ircc_probe_39x, nsc_ircc_init_39x },
 	{ NULL }
 };
 
-static struct nsc_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL };
+static struct nsc_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL, NULL };
 
 static char *dongle_types[] = {
 	"Differential serial interface",


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

^ permalink raw reply related

* [PATCH 4/5] IrDA: sti/cli removal from EP7211 IrDA driver
From: Samuel Ortiz @ 2006-02-13 22:15 UTC (permalink / raw)
  To: ext David S. Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Jean Tourrilhes, IrDA users

This patch replaces the deprecated sti/cli routines with the corresponding
spin_lock ones.

Signed-off-by: David chosrova <david.chosrova-TDf4sKD1mxeHlu7OokbhRg@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

diff --git a/drivers/net/irda/ep7211_ir.c b/drivers/net/irda/ep7211_ir.c
index 3189626..4cba38f 100644
--- a/drivers/net/irda/ep7211_ir.c
+++ b/drivers/net/irda/ep7211_ir.c
@@ -8,6 +8,7 @@
 #include <linux/delay.h>
 #include <linux/tty.h>
 #include <linux/init.h>
+#include <linux/spinlock.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/irda_device.h>
@@ -23,6 +24,8 @@ static void ep7211_ir_close(dongle_t *se
 static int  ep7211_ir_change_speed(struct irda_task *task);
 static int  ep7211_ir_reset(struct irda_task *task);
 
+static DEFINE_SPINLOCK(ep7211_lock);
+
 static struct dongle_reg dongle = {
 	.type = IRDA_EP7211_IR,
 	.open = ep7211_ir_open,
@@ -36,7 +39,7 @@ static void ep7211_ir_open(dongle_t *sel
 {
 	unsigned int syscon1, flags;
 
-	save_flags(flags); cli();
+	spin_lock_irqsave(&ep7211_lock, flags);
 
 	/* Turn on the SIR encoder. */
 	syscon1 = clps_readl(SYSCON1);
@@ -46,14 +49,14 @@ static void ep7211_ir_open(dongle_t *sel
 	/* XXX: We should disable modem status interrupts on the first
 		UART (interrupt #14). */
 
-	restore_flags(flags);
+	spin_unlock_irqrestore(&ep7211_lock, flags);
 }
 
 static void ep7211_ir_close(dongle_t *self)
 {
 	unsigned int syscon1, flags;
 
-	save_flags(flags); cli();
+	spin_lock_irqsave(&ep7211_lock, flags);
 
 	/* Turn off the SIR encoder. */
 	syscon1 = clps_readl(SYSCON1);
@@ -63,7 +66,7 @@ static void ep7211_ir_close(dongle_t *se
 	/* XXX: If we've disabled the modem status interrupts, we should
 		reset them back to their original state. */
 
-	restore_flags(flags);
+	spin_unlock_irqrestore(&ep7211_lock, flags);
 }
 
 /*


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

^ permalink raw reply related

* [PATCH 5/5] IrDA: pci_register_driver conversion
From: Samuel Ortiz @ 2006-02-13 22:15 UTC (permalink / raw)
  To: ext David S. Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Jean Tourrilhes, IrDA users

This patch converts 2 IrDA drivers pci_module_init() calls to
pci_register_driver().

Signed-off-by: Christophe Lucas <clucas-6bugY6I12JBBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Domen Puncer <domen-CvScVCPLwOZg9hUCZPvPmw@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>

diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 3137592..910c0ca 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -1778,7 +1778,7 @@ static struct pci_driver donauboe_pci_dr
 static int __init
 donauboe_init (void)
 {
-  return pci_module_init(&donauboe_pci_driver);
+  return pci_register_driver(&donauboe_pci_driver);
 }
 
 static void __exit
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index a9f49f0..97a49e0 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1887,7 +1887,7 @@ static int __init vlsi_mod_init(void)
 		vlsi_proc_root->owner = THIS_MODULE;
 	}
 
-	ret = pci_module_init(&vlsi_irda_driver);
+	ret = pci_register_driver(&vlsi_irda_driver);
 
 	if (ret && vlsi_proc_root)
 		remove_proc_entry(PROC_DIR, NULL);


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

^ permalink raw reply related

* Re: 2.6.16, sk98lin out of date
From: Alistair John Strachan @ 2006-02-13 23:15 UTC (permalink / raw)
  To: Daniel Drake; +Cc: Matti Aarnio, netdev, linux-kernel
In-Reply-To: <43F0E284.2040805@gentoo.org>

On Monday 13 February 2006 19:48, Daniel Drake wrote:
> Alistair John Strachan wrote:
> > Thanks Matti, I wasn't even aware of this driver. Might I suggest the
> > "old" driver be marked as such in Linux 2.6.16. I guess I must've
> > skipped over it because it begins with "New", and does not contain
> > the word "Marvell", which is indicated exclusively by lspci.
>
> I changed the help text of all 3 drivers (sk98lin/skge/sky2) to
> point out which ones are/aren't interchangable in 2.6.16. The situation
> is a little confusing.

Thanks, this would have prevented my mistake.

> The reason that the sk98lin diff is so huge is because SysKonnect
> effectively added support for a substantially different range of cards
> (Yukon-2) into the existing driver. This is far from the driver quality
> required for the kernel today, so Stephen Hemminger (skge author) wrote
> a new driver (sky2) for the Yukon-2 range.
>
> The long term plan is to obsolete and remove sk98lin, but we aren't
> ready yet: skge issues pop up every month or two, and sky2 is young.
>
> Stephen's own words:
> > I applaud the initiative, but this it is too premature to obsolete
> > the existing driver. There may be lots of chip versions and other
> > variables that make the existing driver a better choice.

Well, Stephen's driver works great for me and sk98lin frankly didn't.

-- 
Cheers,
Alistair.

'No sense being pessimistic, it probably wouldn't work anyway.'
Third year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.

^ permalink raw reply

* Re: [PATCH] 2.6.16: [NETFILTER] Fix Kconfig menu level for x_tables
From: David S. Miller @ 2006-02-13 23:42 UTC (permalink / raw)
  To: laforge; +Cc: netdev, netfilter-devel
In-Reply-To: <20060213110600.GQ4601@sunbeam.de.gnumonks.org>

From: Harald Welte <laforge@netfilter.org>
Date: Mon, 13 Feb 2006 12:06:00 +0100

> [NETFILTER] Fix Kconfig menu level for x_tables
> 
> The new x_tables related Kconfig options appear at the wrong menu level
> without this patch.
> 
> Signed-off-by: Harald Welte <laforge@netfilter.org>

Applied, thanks Harald.

^ permalink raw reply

* Re: [RFC,NETFILTER]: Fix xfrm lookup after SNAT
From: Herbert Xu @ 2006-02-14  1:49 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Linux Netdev List, Netfilter Development Mailinglist
In-Reply-To: <43F0C0ED.8000303@trash.net>

On Mon, Feb 13, 2006 at 06:25:01PM +0100, Patrick McHardy wrote:
> I finally got around to fixing the "ip_finish_output2: No header cache
> and no neighbour!" problem reported by Andi Kleen. Instead of rerouting
> the packet in POST_ROUTING, we reuse the original route for the
> xfrm_lookup. This introduces a small restriction (see changelog entry),
> but I think it should work.
> 
> Herbert, do you see any problems with this patch?

Looks perfect to me.  I think the restriction makes sense since SNAT
is done in post-routing so it's counter-intuitive to repeat the lookup
anyway.
 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [2.6 patch] schedule eepro100.c for removal
From: Adrian Bunk @ 2006-02-14 15:22 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, netdev

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

This patch was already sent on:
- 4 Feb 2006

 Documentation/feature-removal-schedule.txt |    6 ++++++
 drivers/net/eepro100.c                     |    1 +
 2 files changed, 7 insertions(+)

--- linux-2.6.15-mm4-full/Documentation/feature-removal-schedule.txt.old	2006-01-18 08:38:57.000000000 +0100
+++ linux-2.6.15-mm4-full/Documentation/feature-removal-schedule.txt	2006-01-18 08:39:59.000000000 +0100
@@ -164,0 +165,6 @@
+---------------------------
+
+What:   eepro100 network driver
+When:   August 2006
+Why:    replaced by the e100 driver
+Who:    Adrian Bunk <bunk@stusta.de>

--- linux-2.6.16-rc1-mm5-full/drivers/net/eepro100.c.old	2006-02-03 23:37:55.000000000 +0100
+++ linux-2.6.16-rc1-mm5-full/drivers/net/eepro100.c	2006-02-03 23:39:10.000000000 +0100
@@ -2391,6 +2391,7 @@ static int __init eepro100_init_module(v
 #ifdef MODULE
 	printk(version);
 #endif
+	printk(KERN_WARNING "eepro100 will be removed soon, please use the e100 driver\n");
 	return pci_module_init(&eepro100_driver);
 }
 

^ permalink raw reply

* [RFT/PATCH] 3c509: use proper suspend/resume API
From: Pekka Enberg @ 2006-02-14 16:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev

Hi,

I am looking for someone with 3c509 netword card that can do
suspend/resume to test this patch.

			Pekka

Subject: 3c509: use proper suspend/resume API
From: Pekka Enberg <penberg@cs.helsinki.fi>

This patch converts 3c509 driver to use proper suspend/resume API instead of
the deprecated pm_register/pm_unregister.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

Index: 2.6/drivers/net/3c509.c
===================================================================
--- 2.6.orig/drivers/net/3c509.c
+++ 2.6/drivers/net/3c509.c
@@ -174,9 +174,6 @@ struct el3_private {
 	/* skb send-queue */
 	int head, size;
 	struct sk_buff *queue[SKB_QUEUE_SIZE];
-#ifdef CONFIG_PM_LEGACY
-	struct pm_dev *pmdev;
-#endif
 	enum {
 		EL3_MCA,
 		EL3_PNP,
@@ -201,11 +198,15 @@ static void el3_tx_timeout (struct net_d
 static void el3_down(struct net_device *dev);
 static void el3_up(struct net_device *dev);
 static struct ethtool_ops ethtool_ops;
-#ifdef CONFIG_PM_LEGACY
-static int el3_suspend(struct pm_dev *pdev);
-static int el3_resume(struct pm_dev *pdev);
-static int el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data);
+#ifdef CONFIG_PM
+static int el3_suspend(struct device *, pm_message_t);
+static int el3_resume(struct device *);
+#else
+#define el3_suspend NULL
+#define el3_resume NULL
 #endif
+
+
 /* generic device remove for all device types */
 #if defined(CONFIG_EISA) || defined(CONFIG_MCA)
 static int el3_device_remove (struct device *device);
@@ -229,7 +230,9 @@ static struct eisa_driver el3_eisa_drive
 		.driver   = {
 				.name    = "3c509",
 				.probe   = el3_eisa_probe,
-				.remove  = __devexit_p (el3_device_remove)
+				.remove  = __devexit_p (el3_device_remove),
+				.suspend = el3_suspend,
+				.resume  = el3_resume,
 		}
 };
 #endif
@@ -262,6 +265,8 @@ static struct mca_driver el3_mca_driver 
 				.bus = &mca_bus_type,
 				.probe = el3_mca_probe,
 				.remove = __devexit_p(el3_device_remove),
+				.suspend = el3_suspend,
+				.resume  = el3_resume,
 		},
 };
 #endif /* CONFIG_MCA */
@@ -362,10 +367,6 @@ static void el3_common_remove (struct ne
 	struct el3_private *lp = netdev_priv(dev);
 
 	(void) lp;				/* Keep gcc quiet... */
-#ifdef CONFIG_PM_LEGACY
-	if (lp->pmdev)
-		pm_unregister(lp->pmdev);
-#endif
 #if defined(__ISAPNP__)
 	if (lp->type == EL3_PNP)
 		pnp_device_detach(to_pnp_dev(lp->dev));
@@ -572,16 +573,6 @@ no_pnp:
 	if (err)
 		goto out1;
 
-#ifdef CONFIG_PM_LEGACY
-	/* register power management */
-	lp->pmdev = pm_register(PM_ISA_DEV, card_idx, el3_pm_callback);
-	if (lp->pmdev) {
-		struct pm_dev *p;
-		p = lp->pmdev;
-		p->data = (struct net_device *)dev;
-	}
-#endif
-
 	el3_cards++;
 	lp->next_dev = el3_root_dev;
 	el3_root_dev = dev;
@@ -1480,20 +1471,17 @@ el3_up(struct net_device *dev)
 }
 
 /* Power Management support functions */
-#ifdef CONFIG_PM_LEGACY
+#ifdef CONFIG_PM
 
 static int
-el3_suspend(struct pm_dev *pdev)
+el3_suspend(struct device *pdev, pm_message_t state)
 {
 	unsigned long flags;
 	struct net_device *dev;
 	struct el3_private *lp;
 	int ioaddr;
 	
-	if (!pdev && !pdev->data)
-		return -EINVAL;
-
-	dev = (struct net_device *)pdev->data;
+	dev = pdev->driver_data;
 	lp = netdev_priv(dev);
 	ioaddr = dev->base_addr;
 
@@ -1510,17 +1498,14 @@ el3_suspend(struct pm_dev *pdev)
 }
 
 static int
-el3_resume(struct pm_dev *pdev)
+el3_resume(struct device *pdev)
 {
 	unsigned long flags;
 	struct net_device *dev;
 	struct el3_private *lp;
 	int ioaddr;
 	
-	if (!pdev && !pdev->data)
-		return -EINVAL;
-
-	dev = (struct net_device *)pdev->data;
+	dev = pdev->driver_data;
 	lp = netdev_priv(dev);
 	ioaddr = dev->base_addr;
 
@@ -1536,20 +1521,7 @@ el3_resume(struct pm_dev *pdev)
 	return 0;
 }
 
-static int
-el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data)
-{
-	switch (rqst) {
-		case PM_SUSPEND:
-			return el3_suspend(pdev);
-
-		case PM_RESUME:
-			return el3_resume(pdev);
-	}
-	return 0;
-}
-
-#endif /* CONFIG_PM_LEGACY */
+#endif /* CONFIG_PM */
 
 /* Parameters that may be passed into the module. */
 static int debug = -1;

^ permalink raw reply

* Re: [RFC,NETFILTER]: Fix xfrm lookup after SNAT
From: David S. Miller @ 2006-02-15  9:34 UTC (permalink / raw)
  To: herbert; +Cc: netdev, netfilter-devel, kaber
In-Reply-To: <20060214014924.GA954@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Tue, 14 Feb 2006 12:49:24 +1100

> On Mon, Feb 13, 2006 at 06:25:01PM +0100, Patrick McHardy wrote:
> > I finally got around to fixing the "ip_finish_output2: No header cache
> > and no neighbour!" problem reported by Andi Kleen. Instead of rerouting
> > the packet in POST_ROUTING, we reuse the original route for the
> > xfrm_lookup. This introduces a small restriction (see changelog entry),
> > but I think it should work.
> > 
> > Herbert, do you see any problems with this patch?
> 
> Looks perfect to me.  I think the restriction makes sense since SNAT
> is done in post-routing so it's counter-intuitive to repeat the lookup
> anyway.
>  
> > Signed-off-by: Patrick McHardy <kaber@trash.net>
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Looks good to me too, applied to net-2.6

Thanks a lot.

^ permalink raw reply

* Re: [RFT/PATCH] 3c509: use proper suspend/resume API
From: Andrew Morton @ 2006-02-15 10:25 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: linux-kernel, netdev
In-Reply-To: <1139935173.22151.2.camel@localhost>

Pekka Enberg <penberg@cs.helsinki.fi> wrote:
>
> I am looking for someone with 3c509 netword card that can do
>  suspend/resume to test this patch.

I have a 3c509, and I'm not afraid to use it!

Problem is, it doesn't resume correctly either with or without the patch:
it needs rmmod+modprobe to get it going again.  (Which is better than the
aic7xxx driver, which has a coronary and panics the kernel on post-resume
reboot).

But at least nothing got worse, and it makes that darn warning go away.

^ permalink raw reply

* Re: [RFT/PATCH] 3c509: use proper suspend/resume API
From: Pekka J Enberg @ 2006-02-15 11:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, netdev
In-Reply-To: <20060215022523.1d21b9c9.akpm@osdl.org>

On Wed, 15 Feb 2006, Andrew Morton wrote:
> I have a 3c509, and I'm not afraid to use it!
> 
> Problem is, it doesn't resume correctly either with or without the patch:
> it needs rmmod+modprobe to get it going again.  (Which is better than the
> aic7xxx driver, which has a coronary and panics the kernel on post-resume
> reboot).

Is there anything in the logs to give us a clue what's going on? I can't 
see anything obvious looking at the code, but then again I don't have 
datasheets for 3c509 either.

			Pekka

^ permalink raw reply

* Re: [RFT/PATCH] 3c509: use proper suspend/resume API
From: Pekka J Enberg @ 2006-02-15 11:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, netdev
In-Reply-To: <20060215022523.1d21b9c9.akpm@osdl.org>

Hi Andrew,

On Wed, 15 Feb 2006, Andrew Morton wrote:
> Problem is, it doesn't resume correctly either with or without the patch:
> it needs rmmod+modprobe to get it going again.  (Which is better than the
> aic7xxx driver, which has a coronary and panics the kernel on post-resume
> reboot).

Hmm. Either I am totally confused or we don't even attempt suspend/resume 
for eisa and mca bus devices. Care to try this patch?

			Pekka

Index: 2.6/drivers/eisa/eisa-bus.c
===================================================================
--- 2.6.orig/drivers/eisa/eisa-bus.c
+++ 2.6/drivers/eisa/eisa-bus.c
@@ -128,9 +128,31 @@ static int eisa_bus_match (struct device
 	return 0;
 }
 
+static int eisa_bus_suspend(struct device * dev, pm_message_t state)
+{
+	int ret = 0;
+
+	if (dev->driver && dev->driver->suspend)
+		ret = dev->driver->suspend(dev, state);
+
+	return ret;
+}
+
+static int eisa_bus_resume(struct device * dev)
+{
+	int ret = 0;
+
+	if (dev->driver && dev->driver->resume)
+		ret = dev->driver->resume(dev);
+
+	return ret;
+}
+
 struct bus_type eisa_bus_type = {
 	.name  = "eisa",
 	.match = eisa_bus_match,
+	.suspend = eisa_bus_suspend,
+	.resume = eisa_bus_resume,
 };
 
 int eisa_driver_register (struct eisa_driver *edrv)
Index: 2.6/drivers/mca/mca-bus.c
===================================================================
--- 2.6.orig/drivers/mca/mca-bus.c
+++ 2.6/drivers/mca/mca-bus.c
@@ -63,9 +63,32 @@ static int mca_bus_match (struct device 
 	return 0;
 }
 
+static int mca_bus_suspend(struct device * dev, pm_message_t state)
+{
+	int ret = 0;
+
+	if (dev->driver && dev->driver->suspend)
+		ret = dev->driver->suspend(dev, state);
+
+	return ret;
+}
+
+static int mca_bus_resume(struct device * dev)
+{
+	int ret = 0;
+
+	if (dev->driver && dev->driver->resume)
+		ret = dev->driver->resume(dev);
+
+	return ret;
+}
+
+
 struct bus_type mca_bus_type = {
 	.name  = "MCA",
 	.match = mca_bus_match,
+	.suspend = mca_bus_suspend,
+	.resume = mca_bus_resume,
 };
 EXPORT_SYMBOL (mca_bus_type);
 

^ permalink raw reply

* Re: [RFT/PATCH] 3c509: use proper suspend/resume API
From: Andrew Morton @ 2006-02-15 11:52 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel, netdev
In-Reply-To: <Pine.LNX.4.58.0602151256580.14223@sbz-30.cs.Helsinki.FI>

Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
>
> On Wed, 15 Feb 2006, Andrew Morton wrote:
> > I have a 3c509, and I'm not afraid to use it!
> > 
> > Problem is, it doesn't resume correctly either with or without the patch:
> > it needs rmmod+modprobe to get it going again.  (Which is better than the
> > aic7xxx driver, which has a coronary and panics the kernel on post-resume
> > reboot).
> 
> Is there anything in the logs to give us a clue what's going on? I can't 
> see anything obvious looking at the code, but then again I don't have 
> datasheets for 3c509 either.
> 

eeprom reads 0xffff, that's all I noticed.

^ permalink raw reply

* Re: [RFT/PATCH] 3c509: use proper suspend/resume API
From: Russell King @ 2006-02-15 12:40 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: Andrew Morton, linux-kernel, netdev
In-Reply-To: <Pine.LNX.4.58.0602151317110.14223@sbz-30.cs.Helsinki.FI>

On Wed, Feb 15, 2006 at 01:23:19PM +0200, Pekka J Enberg wrote:
> Hmm. Either I am totally confused or we don't even attempt suspend/resume 
> for eisa and mca bus devices. Care to try this patch?

Please don't use struct device_driver suspend/resume methods.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply

* Re: [RFT/PATCH] 3c509: use proper suspend/resume API
From: Andrew Morton @ 2006-02-15 12:45 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel, netdev
In-Reply-To: <Pine.LNX.4.58.0602151317110.14223@sbz-30.cs.Helsinki.FI>

Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
>
>  Hi Andrew,
> 
>  On Wed, 15 Feb 2006, Andrew Morton wrote:
>  > Problem is, it doesn't resume correctly either with or without the patch:
>  > it needs rmmod+modprobe to get it going again.  (Which is better than the
>  > aic7xxx driver, which has a coronary and panics the kernel on post-resume
>  > reboot).
> 
>  Hmm. Either I am totally confused or we don't even attempt suspend/resume 
>  for eisa and mca bus devices. Care to try this patch?

No, el3_suspend() and el3_resume() don't seem to be called.  And they're
still not called with this patch applied..

(I got one resume in which the 3c509 still worked.  Odd.)

^ permalink raw reply

* [XFRM]: Fix SNAT-related crash in xfrm4_output_finish
From: Patrick McHardy @ 2006-02-15 17:25 UTC (permalink / raw)
  To: David S. Miller
  Cc: Kernel Netdev Mailing List, Netfilter Development Mailinglist,
	Herbert Xu

[-- Attachment #1: Type: text/plain, Size: 81 bytes --]

This patch fixes the crash in xfrm4_output_finish reported by
multiple people.



[-- Attachment #2: 01.diff --]
[-- Type: text/x-patch, Size: 7678 bytes --]

[XFRM]: Fix SNAT-related crash in xfrm4_output_finish

When a packet matching an IPsec policy is SNATed so it doesn't match any
policy anymore it looses its xfrm bundle, which makes xfrm4_output_finish
crash because of a NULL pointer dereference.

This patch directs these packets to the original output path instead. Since
the packets have already passed the POST_ROUTING hook, but need to start at
the beginning of the original output path which includes another
POST_ROUTING invocation, a flag is added to the IPCB to indicate that the
packet was rerouted and doesn't need to pass the POST_ROUTING hook again.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit a31ab06c99e45232b742803677e88363cda2fb85
tree 020e91264409d418d615599a5880df68ca640432
parent ede836cd3164896d741dff1a8d7c1dc0b9b1fdf6
author Patrick McHardy <kaber@trash.net> Wed, 15 Feb 2006 17:30:44 +0100
committer Patrick McHardy <kaber@trash.net> Wed, 15 Feb 2006 17:30:44 +0100

 include/linux/netfilter.h |   19 +++++++++++++++----
 include/net/ip.h          |    1 +
 include/net/xfrm.h        |    1 -
 net/ipv4/ip_gre.c         |    3 ++-
 net/ipv4/ip_output.c      |   16 ++++++++++------
 net/ipv4/ipip.c           |    3 ++-
 net/ipv4/xfrm4_output.c   |   13 ++++++++++---
 7 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 4cf6088..5deacda 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -184,8 +184,11 @@ static inline int nf_hook_thresh(int pf,
 				 struct sk_buff **pskb,
 				 struct net_device *indev,
 				 struct net_device *outdev,
-				 int (*okfn)(struct sk_buff *), int thresh)
+				 int (*okfn)(struct sk_buff *), int thresh,
+				 int cond)
 {
+	if (!cond)
+		return 1;
 #ifndef CONFIG_NETFILTER_DEBUG
 	if (list_empty(&nf_hooks[pf][hook]))
 		return 1;
@@ -197,7 +200,7 @@ static inline int nf_hook(int pf, unsign
 			  struct net_device *indev, struct net_device *outdev,
 			  int (*okfn)(struct sk_buff *))
 {
-	return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN);
+	return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN, 1);
 }
                    
 /* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -224,7 +227,13 @@ static inline int nf_hook(int pf, unsign
 
 #define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh)	       \
 ({int __ret;								       \
-if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1)\
+if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh, 1)) == 1)\
+	__ret = (okfn)(skb);						       \
+__ret;})
+
+#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond)		       \
+({int __ret;								       \
+if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\
 	__ret = (okfn)(skb);						       \
 __ret;})
 
@@ -295,11 +304,13 @@ extern struct proc_dir_entry *proc_net_n
 
 #else /* !CONFIG_NETFILTER */
 #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
+#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
 static inline int nf_hook_thresh(int pf, unsigned int hook,
 				 struct sk_buff **pskb,
 				 struct net_device *indev,
 				 struct net_device *outdev,
-				 int (*okfn)(struct sk_buff *), int thresh)
+				 int (*okfn)(struct sk_buff *), int thresh,
+				 int cond)
 {
 	return okfn(*pskb);
 }
diff --git a/include/net/ip.h b/include/net/ip.h
index 8de0697..fab3d5b 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -41,6 +41,7 @@ struct inet_skb_parm
 #define IPSKB_XFRM_TUNNEL_SIZE	2
 #define IPSKB_XFRM_TRANSFORMED	4
 #define IPSKB_FRAG_COMPLETE	8
+#define IPSKB_REROUTED		16
 };
 
 struct ipcm_cookie
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d09ca0e..d6111a2 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -866,7 +866,6 @@ extern int xfrm_state_mtu(struct xfrm_st
 extern int xfrm_init_state(struct xfrm_state *x);
 extern int xfrm4_rcv(struct sk_buff *skb);
 extern int xfrm4_output(struct sk_buff *skb);
-extern int xfrm4_output_finish(struct sk_buff *skb);
 extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
 extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
 extern int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index abe2392..9981dcd 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -830,7 +830,8 @@ static int ipgre_tunnel_xmit(struct sk_b
 	skb->h.raw = skb->nh.raw;
 	skb->nh.raw = skb_push(skb, gre_hlen);
 	memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
-	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE|IPSKB_XFRM_TRANSFORMED);
+	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
+			      IPSKB_REROUTED);
 	dst_release(skb->dst);
 	skb->dst = &rt->u.dst;
 
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 3324fbf..57d290d 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -207,8 +207,10 @@ static inline int ip_finish_output(struc
 {
 #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM)
 	/* Policy lookup after SNAT yielded a new policy */
-	if (skb->dst->xfrm != NULL)
-		return xfrm4_output_finish(skb);
+	if (skb->dst->xfrm != NULL) {
+		IPCB(skb)->flags |= IPSKB_REROUTED;
+		return dst_output(skb);
+	}
 #endif
 	if (skb->len > dst_mtu(skb->dst) &&
 	    !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size))
@@ -271,8 +273,9 @@ int ip_mc_output(struct sk_buff *skb)
 				newskb->dev, ip_dev_loopback_xmit);
 	}
 
-	return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dev,
-		       ip_finish_output);
+	return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dev,
+			    ip_finish_output,
+			    !(IPCB(skb)->flags & IPSKB_REROUTED));
 }
 
 int ip_output(struct sk_buff *skb)
@@ -284,8 +287,9 @@ int ip_output(struct sk_buff *skb)
 	skb->dev = dev;
 	skb->protocol = htons(ETH_P_IP);
 
-	return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev,
-		       ip_finish_output);
+	return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev,
+		            ip_finish_output,
+			    !(IPCB(skb)->flags & IPSKB_REROUTED));
 }
 
 int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index e5cbe72..03d1374 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -622,7 +622,8 @@ static int ipip_tunnel_xmit(struct sk_bu
 	skb->h.raw = skb->nh.raw;
 	skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
 	memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
-	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE|IPSKB_XFRM_TRANSFORMED);
+	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
+			      IPSKB_REROUTED);
 	dst_release(skb->dst);
 	skb->dst = &rt->u.dst;
 
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index d4df0dd..32ad229 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -152,10 +152,16 @@ error_nolock:
 	goto out_exit;
 }
 
-int xfrm4_output_finish(struct sk_buff *skb)
+static int xfrm4_output_finish(struct sk_buff *skb)
 {
 	int err;
 
+#ifdef CONFIG_NETFILTER
+	if (!skb->dst->xfrm) {
+		IPCB(skb)->flags |= IPSKB_REROUTED;
+		return dst_output(skb);
+	}
+#endif
 	while (likely((err = xfrm4_output_one(skb)) == 0)) {
 		nf_reset(skb);
 
@@ -178,6 +184,7 @@ int xfrm4_output_finish(struct sk_buff *
 
 int xfrm4_output(struct sk_buff *skb)
 {
-	return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
-		       xfrm4_output_finish);
+	return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
+			    xfrm4_output_finish,
+			    !(IPCB(skb)->flags & IPSKB_REROUTED));
 }

^ permalink raw reply related

* [NETFILTER]: Don't invoke okfn in CONFIG_NETFILTER=n variant of nf_hook()
From: Patrick McHardy @ 2006-02-15 17:25 UTC (permalink / raw)
  To: David S. Miller
  Cc: Kernel Netdev Mailing List, Netfilter Development Mailinglist,
	Herbert Xu

[-- Attachment #1: Type: text/plain, Size: 53 bytes --]

Another fix related to the netfilter IPsec patches.


[-- Attachment #2: 02.diff --]
[-- Type: text/x-patch, Size: 1119 bytes --]

[NETFILTER]: Don't invoke okfn in CONFIG_NETFILTER=n variant of nf_hook()

nf_hook() is supposed to call the netfilter hook and return control of the
packet back to the caller in case it may pass, the okfn is only used for
queueing.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 4611d14cc145cb244634920a7c4b0082f3c08eda
tree 84c175affb78b77e78d908ea8baef43d9dba698a
parent a31ab06c99e45232b742803677e88363cda2fb85
author Patrick McHardy <kaber@trash.net> Wed, 15 Feb 2006 17:39:55 +0100
committer Patrick McHardy <kaber@trash.net> Wed, 15 Feb 2006 17:39:55 +0100

 include/linux/netfilter.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 5deacda..aa7bb93 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -318,7 +318,7 @@ static inline int nf_hook(int pf, unsign
 			  struct net_device *indev, struct net_device *outdev,
 			  int (*okfn)(struct sk_buff *))
 {
-	return okfn(*pskb);
+	return 1;
 }
 static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
 struct flowi;

^ permalink raw reply related

* Re: [RFT/PATCH] 3c509: use proper suspend/resume API
From: Pekka Enberg @ 2006-02-15 17:32 UTC (permalink / raw)
  To: Russell King; +Cc: Andrew Morton, linux-kernel, netdev
In-Reply-To: <20060215124020.GA1508@flint.arm.linux.org.uk>

On Wed, Feb 15, 2006 at 01:23:19PM +0200, Pekka J Enberg wrote:
> > Hmm. Either I am totally confused or we don't even attempt suspend/resume 
> > for eisa and mca bus devices. Care to try this patch?

On Wed, 2006-02-15 at 12:40 +0000, Russell King wrote:
> Please don't use struct device_driver suspend/resume methods.

So what would be more appropriate? Move suspend/resume/probe and friends
to eisa_driver and mca_driver?

			Pekka

^ permalink raw reply

* Re: [PATCH wireless-2.6] bcm43xx-d80211: fix oops when removing the module
From: Michael Buesch @ 2006-02-15 21:34 UTC (permalink / raw)
  To: Jiri Benc; +Cc: John W. Linville, NetDev, bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w
In-Reply-To: <20060215202147.69b82ee2-IhiK2ZEFs2oCVLCxKZUutA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 846 bytes --]

On Wednesday 15 February 2006 20:21, you wrote:
> This patch fixes an oops when bcm43xx-d80211 module is unloaded.

This is already fixed in my tree.

> Signed-off-by: Jiri Benc <jbenc-AlSwsSmVLrQ@public.gmane.org>
> 
> --- dscape.testing.orig/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c	2006-02-15 20:06:07.000000000 +0100
> +++ dscape.testing/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c	2006-02-15 20:07:17.000000000 +0100
> @@ -4785,7 +4785,8 @@ static void __devexit bcm43xx_remove_one
>  	ieee80211_unregister_hw(net_dev);
>  	bcm43xx_detach_board(bcm);
>  	destroy_workqueue(bcm->workqueue);
> -	kfree_skb(bcm->cached_beacon);
> +	if (bcm->cached_beacon)
> +		kfree_skb(bcm->cached_beacon);
>  	assert(bcm->ucode == NULL);
>  	ieee80211_free_hw(net_dev);
>  	kfree(ieee);
> 
> 

-- 
Greetings Michael.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH 1/6] x25: Allow 32 bit socket ioctl in 64 bit kernel
From: Shaun Pereira @ 2006-02-15 22:18 UTC (permalink / raw)
  To: netdev, David S. Miller, x25 maintainer, linux-kenel
  Cc: Arnd Bergmann, Andre Hendry

Hi

The following patch provides 32 bit userland ioctl support for modular
(x.25 type) socket ioctls in a 64 bit kernel. Since the the
register_ioctl32_conversion() is now obsolete, this patch provides a
mechanism to allow 32 bit user space ioctls to reach the kernel. 

Signed-off-by:Shaun Pereira <spereira@tusc.com.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>

diff -uprN -X dontdiff linux-2.6.16-rc3-vanilla/include/linux/net.h
linux-2.6.16-rc3/include/linux/net.h
--- linux-2.6.16-rc3-vanilla/include/linux/net.h	2006-02-15
10:58:02.000000000 +1100
+++ linux-2.6.16-rc3/include/linux/net.h	2006-02-15 11:02:24.000000000
+1100
@@ -143,6 +143,8 @@ struct proto_ops {
 				      struct poll_table_struct *wait);
 	int		(*ioctl)     (struct socket *sock, unsigned int cmd,
 				      unsigned long arg);
+	int	 	(*compat_ioctl) (struct socket *sock, unsigned int cmd,
+				      unsigned long arg);
 	int		(*listen)    (struct socket *sock, int len);
 	int		(*shutdown)  (struct socket *sock, int flags);
 	int		(*setsockopt)(struct socket *sock, int level,
@@ -247,6 +249,8 @@ SOCKCALL_UWRAP(name, poll, (struct file 
 	      (file, sock, wait)) \
 SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \
 			 unsigned long arg), (sock, cmd, arg)) \
+SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int
cmd, \
+			 unsigned long arg), (sock, cmd, arg)) \
 SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock,
len)) \
 SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock,
flags)) \
 SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int
optname, \
@@ -271,6 +275,7 @@ static const struct proto_ops name##_ops
 	.getname	= __lock_##name##_getname,	\
 	.poll		= __lock_##name##_poll,		\
 	.ioctl		= __lock_##name##_ioctl,	\
+	.compat_ioctl	= __lock_##name##_compat_ioctl,	\
 	.listen		= __lock_##name##_listen,	\
 	.shutdown	= __lock_##name##_shutdown,	\
 	.setsockopt	= __lock_##name##_setsockopt,	\
@@ -279,6 +284,7 @@ static const struct proto_ops name##_ops
 	.recvmsg	= __lock_##name##_recvmsg,	\
 	.mmap		= __lock_##name##_mmap,		\
 };
+
 #endif
 
 #define MODULE_ALIAS_NETPROTO(proto) \
diff -uprN -X dontdiff linux-2.6.16-rc3-vanilla/net/socket.c
linux-2.6.16-rc3/net/socket.c
--- linux-2.6.16-rc3-vanilla/net/socket.c	2006-02-15 10:58:03.000000000
+1100
+++ linux-2.6.16-rc3/net/socket.c	2006-02-15 11:02:24.000000000 +1100
@@ -109,6 +109,10 @@ static unsigned int sock_poll(struct fil
 			      struct poll_table_struct *wait);
 static long sock_ioctl(struct file *file,
 		      unsigned int cmd, unsigned long arg);
+#ifdef CONFIG_COMPAT
+static long compat_sock_ioctl(struct file *file,
+		      unsigned int cmd, unsigned long arg);
+#endif
 static int sock_fasync(int fd, struct file *filp, int on);
 static ssize_t sock_readv(struct file *file, const struct iovec
*vector,
 			  unsigned long count, loff_t *ppos);
@@ -130,6 +134,9 @@ static struct file_operations socket_fil
 	.aio_write =	sock_aio_write,
 	.poll =		sock_poll,
 	.unlocked_ioctl = sock_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = compat_sock_ioctl,
+#endif
 	.mmap =		sock_mmap,
 	.open =		sock_no_open,	/* special open code to disallow open via /proc
*/
 	.release =	sock_close,
@@ -2089,6 +2096,20 @@ void socket_seq_show(struct seq_file *se
 }
 #endif /* CONFIG_PROC_FS */
 
+#ifdef CONFIG_COMPAT
+static long compat_sock_ioctl(struct file *file, unsigned cmd, unsigned
long arg)
+{
+	struct socket *sock;
+	sock = file->private_data;
+
+	int ret = -ENOIOCTLCMD;
+	if(sock->ops->compat_ioctl)
+		ret = sock->ops->compat_ioctl(sock, cmd, arg);
+
+	return ret;
+}
+#endif
+
 /* ABI emulation layers need these two */
 EXPORT_SYMBOL(move_addr_to_kernel);
 EXPORT_SYMBOL(move_addr_to_user);

^ permalink raw reply

* [PATCH 2/6] x25: Allow 32 bit socket ioctl in 64 bit kernel
From: Shaun Pereira @ 2006-02-15 22:18 UTC (permalink / raw)
  To: netdev, x25 maintainer, linux-kenel, David S. Miller
  Cc: Andre Hendry, Arnd Bergmann

This patch is the first step towards migration of the 'handler
functions' for 32-64 bit userspace-kernel conversion, away from the
ioctl32_hash_table. It will be used by the x25 socket layer. 
  
Signed-off-by:Shaun Pereira <spereira@tusc.com.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>

diff -uprN -X dontdiff linux-2.6.16-rc3-vanilla/include/net/compat.h
linux-2.6.16-rc3/include/net/compat.h
--- linux-2.6.16-rc3-vanilla/include/net/compat.h	2006-02-15
10:58:03.000000000 +1100
+++ linux-2.6.16-rc3/include/net/compat.h	2006-02-15 11:09:00.000000000
+1100
@@ -23,6 +23,8 @@ struct compat_cmsghdr {
 	compat_int_t	cmsg_type;
 };
 
+extern int compat_sock_get_timestamp(struct sock *, struct timeval
__user *);
+
 #else /* defined(CONFIG_COMPAT) */
 #define compat_msghdr	msghdr		/* to avoid compiler warnings */
 #endif /* defined(CONFIG_COMPAT) */
diff -uprN -X dontdiff linux-2.6.16-rc3-vanilla/net/compat.c
linux-2.6.16-rc3/net/compat.c
--- linux-2.6.16-rc3-vanilla/net/compat.c	2006-02-15 10:58:03.000000000
+1100
+++ linux-2.6.16-rc3/net/compat.c	2006-02-15 11:09:00.000000000 +1100
@@ -503,6 +503,23 @@ static int do_get_sock_timeout(int fd, i
 	return err;
 }
 
+int compat_sock_get_timestamp(struct sock *sk, struct timeval __user
*userstamp)
+{
+	struct compat_timeval __user *ctv
+		= (struct compat_timeval __user*) userstamp;
+	int err = -ENOENT;
+	if(!sock_flag(sk, SOCK_TIMESTAMP))
+		sock_enable_timestamp(sk);
+	if(sk->sk_stamp.tv_sec == -1)
+		return err;
+	if(sk->sk_stamp.tv_sec == 0)
+		do_gettimeofday(&sk->sk_stamp);
+	if (put_user(sk->sk_stamp.tv_sec, &ctv->tv_sec) |
+			put_user(sk->sk_stamp.tv_usec, &ctv->tv_usec))
+				err = -EFAULT;
+	return err;
+}
+
 asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
 				char __user *optval, int __user *optlen)
 {
@@ -602,3 +619,5 @@ asmlinkage long compat_sys_socketcall(in
 	}
 	return ret;
 }
+
+EXPORT_SYMBOL(compat_sock_get_timestamp);

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox