* Re: [Patch] 2.4.32 - Neighbour Cache (ARP) State machine bug Fixed
From: Bill Davidsen @ 2006-02-10 20:35 UTC (permalink / raw)
To: gcoady; +Cc: netdev, linux-kernel
In-Reply-To: <4skiu150r13a2a78i68bg28cvdb67a8qjb@4ax.com>
Grant Coady wrote:
> On Tue, 7 Feb 2006 17:50:03 -0800, Pradeep Vincent <pradeep.vincent@gmail.com> wrote:
>
>
>>One more attempt. Attaching the diff file as well.
>>
>>Signed off by: Pradeep Vincent <pradeep.vincent@gmail.com>
>>
>>--- old/net/core/neighbour.c Wed Nov 9 16:48:10 2005
>>+++ new/net/core/neighbour.c Tue Feb 7 17:38:26 2006
>>@@ -14,6 +14,7 @@
>> * Vitaly E. Lavrov releasing NULL neighbor in neigh_add.
>> * Harald Welte Add neighbour cache statistics like rtstat
>> * Harald Welte port neighbour cache rework from 2.6.9-rcX
>>+ * Pradeep Vincent fix neighbour cache state machine
>> */
>>
>>#include <linux/config.h>
>>@@ -705,6 +706,13 @@
>> neigh_release(n);
>> continue;
>> }
>>+ /* Move to NUD_STALE state */
>>+ if (n->nud_state&NUD_REACHABLE &&
>>+ now - n->confirmed > n->parms->reachable_time) {
>
>
> Hmm, you're suffering tab -> space conversion syndrome :(
>
> Grant.
The attachment has tabs here, don't know what you're seeing.
--
bill davidsen <davidsen@tmr.com>
CTO TMR Associates, Inc
Doing interesting things with small computers since 1979
^ permalink raw reply
* [PATCH] TC: bug fixes to the "sample" clause
From: Russell Stuart @ 2006-02-10 2:33 UTC (permalink / raw)
To: netdev, lartc, shemminger
PATCH 1
=======
On my machine tc does not parse filter "sample" for the u32
filter. Eg:
tc filter add dev eth2 parent 1:0 protocol ip prio 1 u32 ht 801: \
classid 1:3 \
sample ip protocol 1 0xff match ip protocol 1 0xff
Illegal "sample"
The reason is a missing memset. This patch fixes it.
diff -Nur iproute-20051007.keep/tc/f_u32.c iproute-20051007/tc/f_u32.c
--- iproute-20051007.keep/tc/f_u32.c 2005-01-19 08:11:58.000000000 +1000
+++ iproute-20051007/tc/f_u32.c 2006-01-12 17:12:43.000000000 +1000
@@ -878,6 +878,7 @@
struct tc_u32_sel sel;
struct tc_u32_key keys[4];
} sel2;
+ memset(&sel2, 0, sizeof(sel2));
NEXT_ARG();
if (parse_selector(&argc, &argv, &sel2.sel, n)) {
fprintf(stderr, "Illegal \"sample\"\n");
PATCH 2
=======
In tc, the u32 sample clause uses the 2.4 hashing algorithm.
The hashing algorithm used by the kernel changed in 2.6,
consequently "sample" hasn't work since then.
This patch makes the sample clause work for both 2.4 and 2.6:
diff -Nur iproute-20051007.keep/tc/f_u32.c iproute-20051007/tc/f_u32.c
--- iproute-20051007.keep/tc/f_u32.c 2006-01-12 17:34:37.000000000 +1000
+++ iproute-20051007/tc/f_u32.c 2006-02-07 17:10:29.000000000 +1000
@@ -17,6 +17,7 @@
#include <syslog.h>
#include <fcntl.h>
#include <sys/socket.h>
+#include <sys/utsname.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
@@ -874,6 +875,7 @@
htid = (handle&0xFFFFF000);
} else if (strcmp(*argv, "sample") == 0) {
__u32 hash;
+ struct utsname utsname;
struct {
struct tc_u32_sel sel;
struct tc_u32_key keys[4];
@@ -889,8 +891,19 @@
return -1;
}
hash = sel2.sel.keys[0].val&sel2.sel.keys[0].mask;
- hash ^= hash>>16;
- hash ^= hash>>8;
+ uname(&utsname);
+ if (strncmp(utsname.release, "2.4.", 4) == 0) {
+ hash ^= hash>>16;
+ hash ^= hash>>8;
+ }
+ else {
+ __u32 mask = sel2.sel.keys[0].mask;
+ while (mask && !(mask & 1)) {
+ mask >>= 1;
+ hash >>= 1;
+ }
+ hash &= 0xFF;
+ }
htid = ((hash<<12)&0xFF000)|(htid&0xFFF00000);
sample_ok = 1;
continue;
PATCH 3
=======
"tc" does not allow you to specify the divisor for the
"sample" clause, it always assumes a divisor of 256.
If the divisor isn't 256, (ie it is something less),
the kernel will usually whinge because the bucket given
to it by "tc" is typically too big.
This patch adds a "divisor" option to tc's "sample"
clause:
diff -Nur iproute-20051007.keep/tc/f_u32.c iproute-20051007/tc/f_u32.c
--- iproute-20051007.keep/tc/f_u32.c 2006-02-10 11:40:16.000000000 +1000
+++ iproute-20051007/tc/f_u32.c 2006-02-10 11:47:14.000000000 +1000
@@ -35,7 +35,7 @@
fprintf(stderr, "or u32 divisor DIVISOR\n");
fprintf(stderr, "\n");
fprintf(stderr, "Where: SELECTOR := SAMPLE SAMPLE ...\n");
- fprintf(stderr, " SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} | mark } SAMPLE_ARGS\n");
+ fprintf(stderr, " SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} | mark } SAMPLE_ARGS [divisor DIVISOR]\n");
fprintf(stderr, " FILTERID := X:Y:Z\n");
}
@@ -835,7 +835,7 @@
unsigned divisor;
NEXT_ARG();
if (get_unsigned(&divisor, *argv, 0) || divisor == 0 ||
- divisor > 0x100) {
+ divisor > 0x100 || (divisor - 1 & divisor)) {
fprintf(stderr, "Illegal \"divisor\"\n");
return -1;
}
@@ -875,6 +875,7 @@
htid = (handle&0xFFFFF000);
} else if (strcmp(*argv, "sample") == 0) {
__u32 hash;
+ unsigned divisor = 0x100;
struct utsname utsname;
struct {
struct tc_u32_sel sel;
@@ -890,6 +891,15 @@
fprintf(stderr, "\"sample\" must contain exactly ONE key.\n");
return -1;
}
+ if (*argv != 0 && strcmp(*argv, "divisor") == 0) {
+ NEXT_ARG();
+ if (get_unsigned(&divisor, *argv, 0) || divisor == 0 ||
+ divisor > 0x100 || (divisor - 1 & divisor)) {
+ fprintf(stderr, "Illegal sample \"divisor\"\n");
+ return -1;
+ }
+ NEXT_ARG();
+ }
hash = sel2.sel.keys[0].val&sel2.sel.keys[0].mask;
uname(&utsname);
if (strncmp(utsname.release, "2.4.", 4) == 0) {
@@ -904,7 +913,7 @@
}
hash &= 0xFF;
}
- htid = ((hash<<12)&0xFF000)|(htid&0xFFF00000);
+ htid = ((hash%divisor)<<12)|(htid&0xFFF00000);
sample_ok = 1;
continue;
} else if (strcmp(*argv, "indev") == 0) {
^ permalink raw reply
* Re: [PATCH 2/3] bridge: netfilter handle RCU during removal
From: David S. Miller @ 2006-02-10 1:09 UTC (permalink / raw)
To: shemminger; +Cc: netdev, netfilter-devel
In-Reply-To: <20060206222853.844546000@dxpl.pdx.osdl.net>
From: Stephen Hemminger <shemminger@osdl.org>
Date: Mon, 06 Feb 2006 14:27:34 -0800
> Bridge netfilter code needs to handle the case where device is
> removed from bridge while packet in process. In these cases the
> bridge_parent can be come null while processing.
>
> This should fix: http://bugzilla.kernel.org/show_bug.cgi?id=5803
>
> Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Applied to net-2.6, thanks a lot.
^ permalink raw reply
* Re: [PATCH 0/7] IrDA updates
From: David S. Miller @ 2006-02-10 1:04 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, jt-sDzT885Ts8HQT0dZR+AlfA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <Pine.LNX.4.58.0602090248090.19426@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 9 Feb 2006 23:31:31 +0200 (EET)
> So, next will come a set of 7 patches. Some of them are patches that have
> been floating around the irda mailing list and others are fixes or
> improvements based on Jean's latest TODO list.
I applied patches 4 and 7 to net-2.6 by hand, and I didn't attempt
to put the others, which were feature patches into net-2.6.17.
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.
Thanks a lot.
-------------------------------------------------------
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
* Re: [PATCH 7/7] IrDA: out of range array access
From: David S. Miller @ 2006-02-10 1:00 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: jt-sDzT885Ts8HQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <Pine.LNX.4.58.0602092231470.4121@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 9 Feb 2006 23:32:43 +0200 (EET)
> This patch fixes an out of range array access in irnet_irda.c.
>
> Author: David Binderman <dcb314-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Bug fix, so applied to net-2.6
thanks
-------------------------------------------------------
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
* Re: [PATCH 4/7] IrDA: Set proper IrLAP device address length
From: David S. Miller @ 2006-02-10 0:58 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: jt-sDzT885Ts8HQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <Pine.LNX.4.58.0602090323140.19426@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 9 Feb 2006 23:32:16 +0200 (EET)
> This patch set IrDA's addr_len properly, i.e to 4 bytes, the size of the
> IrLAP device address.
>
> Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Bug fix, so applied to net-2.6
-------------------------------------------------------
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
* Re: [GIT PULL] bcm43xx: Update B6PHY initialization
From: John W. Linville @ 2006-02-10 0:51 UTC (permalink / raw)
To: Danny van Dyk
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w
In-Reply-To: <200602011051.00973.kugelfang-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
In the future, please include a Signed-off-by: line in your patches
or git commits...thanks!
John
On Wed, Feb 01, 2006 at 10:51:00AM +0100, Danny van Dyk wrote:
> John, please
>
> git pull rsync://pitr.amd64.dev.gentoo.org/kugelfang/wireless-2.6.git
>
> which will provide this changeset:
>
> Danny van Dyk:
> [bcm43xx] Sync bcm43xx_phy_initb6() with specs
>
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> index f5e7a6a..d90f207 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> @@ -947,7 +947,7 @@ static void bcm43xx_phy_initb6(struct bc
> bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
> if ((bcm->current_core->radio->manufact == 0x17F) &&
> (bcm->current_core->radio->version == 0x2050) &&
> - (bcm->current_core->radio->revision == 2)) {
> + (bcm->current_core->radio->revision <= 2)) {
> bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
> bcm43xx_radio_write16(bcm, 0x005A, 0x0070);
> bcm43xx_radio_write16(bcm, 0x005B, 0x007B);
> @@ -984,10 +984,15 @@ static void bcm43xx_phy_initb6(struct bc
> bcm43xx_write16(bcm, 0x03E4, 0x0009);
> if (phy->type == BCM43xx_PHYTYPE_B) {
> bcm43xx_write16(bcm, 0x03E6, 0x8140);
> - bcm43xx_phy_write(bcm, 0x0016, 0x5410);
> - bcm43xx_phy_write(bcm, 0x0017, 0xA820);
> - bcm43xx_phy_write(bcm, 0x0007, 0x0062);
> - TODO();//TODO: calibrate stuff.
> + bcm43xx_phy_write(bcm, 0x0016, 0x0410);
> + bcm43xx_phy_write(bcm, 0x0017, 0x0820);
> + bcm43xx_phy_write(bcm, 0x0062, 0x0007);
> + (void) bcm43xx_radio_calibrationvalue(bcm);
> + bcm43xx_phy_lo_b_measure(bcm);
> + if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) {
> + bcm43xx_calc_nrssi_slope(bcm);
> + bcm43xx_calc_nrssi_threshold(bcm);
> + }
> bcm43xx_phy_init_pctl(bcm);
> } else
> bcm43xx_write16(bcm, 0x03E6, 0x0);
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> index 5ce6ace..3901aa9 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> @@ -1184,7 +1184,7 @@ int bcm43xx_radio_set_interference_mitig
> return 0;
> }
>
> -static u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm)
> +u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm)
> {
> u16 reg, index, ret;
>
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> b/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> index 89fe292..a5d2e10 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> @@ -89,5 +89,6 @@ void bcm43xx_nrssi_hw_update(struct bcm4
> void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm);
>
> void bcm43xx_radio_set_tx_iq(struct bcm43xx_private *bcm);
> +u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm);
>
> #endif /* BCM43xx_RADIO_H_ */
> --
> Danny van Dyk <kugelfang-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
> Gentoo/AMD64 Project, Gentoo Scientific Project
>
> --
> Danny van Dyk <kugelfang-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
> Gentoo/AMD64 Project, Gentoo Scientific Project
--
John W. Linville
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
^ permalink raw reply
* [PATCH 7/7] IrDA: out of range array access
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
This patch fixes an out of range array access in irnet_irda.c.
Author: David Binderman <dcb314-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index 07ec326..e477a8d 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -696,7 +696,7 @@ irnet_daddr_to_dname(irnet_socket * self
{
/* Yes !!! Get it.. */
strlcpy(self->rname, discoveries[i].info, sizeof(self->rname));
- self->rname[NICKNAME_MAX_LEN + 1] = '\0';
+ self->rname[sizeof(self->rname) - 1] = '\0';
DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n",
self->daddr, self->rname);
kfree(discoveries);
-------------------------------------------------------
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 6/7] IrDA: pci_register_driver conversion
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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
* [PATCH 5/7] IrDA: sti/cli removal from EP7211 IrDA driver
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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..6edf988 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>
@@ -15,6 +16,7 @@
#include <asm/io.h>
#include <asm/hardware.h>
+
#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
#define MAX_DELAY 10000 /* 1 ms */
@@ -23,6 +25,7 @@ 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 spinlock_t 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_lock_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_lock_irqrestore(&ep7211_lock, flags);
}
/*
@@ -99,6 +102,7 @@ static int ep7211_ir_reset(struct irda_t
*/
static int __init ep7211_ir_init(void)
{
+ spin_lock_init(&ep7211_lock);
return irda_device_register_dongle(&dongle);
}
-------------------------------------------------------
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/7] IrDA: Set proper IrLAP device address length
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
This patch set IrDA's addr_len properly, i.e to 4 bytes, the size of the
IrLAP device address.
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
index f55e86e..2127cae 100644
--- a/include/net/irda/irlap.h
+++ b/include/net/irda/irlap.h
@@ -50,6 +50,9 @@
/* May be different when we get VFIR */
#define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER)
+/* Each IrDA device gets a random 32 bits IRLAP device address */
+#define LAP_ALEN 4
+
#define BROADCAST 0xffffffff /* Broadcast device address */
#define CBROADCAST 0xfe /* Connection broadcast address */
#define XID_FORMAT 0x01 /* Discovery XID format */
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index 890bac0..e3debbd 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -343,12 +343,12 @@ static void irda_task_timer_expired(void
static void irda_device_setup(struct net_device *dev)
{
dev->hard_header_len = 0;
- dev->addr_len = 0;
+ dev->addr_len = LAP_ALEN;
dev->type = ARPHRD_IRDA;
dev->tx_queue_len = 8; /* Window size + 1 s-frame */
- memset(dev->broadcast, 0xff, 4);
+ memset(dev->broadcast, 0xff, LAP_ALEN);
dev->mtu = 2048;
dev->flags = IFF_NOARP;
-------------------------------------------------------
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/7] IrDA: nsc-ircc: support for yet another Thinkpad IrDA chipset
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, ext Jean Tourrilhes,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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 2/7] IrDA: nsc-ircc: PM update
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, ext Jean Tourrilhes,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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 1/7] IrDA: nsc-ircc: ISAPnP support
From: Samuel Ortiz @ 2006-02-09 21:31 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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 0/7] IrDA updates
From: Samuel Ortiz @ 2006-02-09 21:31 UTC (permalink / raw)
To: ext David S. Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, ext Jean Tourrilhes,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Hi Dave,
I'm currently working together with Jean for taking over the IrDA
maintainership, since he has no longer that much time to work on it. You
were looking for a cell phone maniac, here I am ;-)
So, next will come a set of 7 patches. Some of them are patches that have
been floating around the irda mailing list and others are fixes or
improvements based on Jean's latest TODO list.
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
* Re: KERNEL: assertion (!sk->sk_forward_alloc) failed
From: Ian McDonald @ 2006-02-09 19:37 UTC (permalink / raw)
To: bb; +Cc: Jesse Brandeburg, Yoseph Basri, linux-kernel, NetDEV list
In-Reply-To: <43EB98B0.4@kernelpanic.ru>
On 2/10/06, Boris B. Zhmurov <bb@kernelpanic.ru> wrote:
> Hello, Ian McDonald.
>
> On 09.02.2006 22:25 you said the following:
>
> > Is it possible for you to download 2.6.16-rc2 or similar and see if it
> > goes away?
>
> It'll be better, if I get only patch fixs that problem, not all 2.6.16-rc2.
>
Oops I didn't read Jesse's message earlier properly.
That patch which probably fixed it is (from his message):
I think the commit id that is missing from 2.6.14.X is
fb5f5e6e0cebd574be737334671d1aa8f170d5f3
but here is the web link if i gave the wrong info
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fb5f5e6e0cebd574be737334671d1aa8f170d5f3
--
Ian McDonald
http://wand.net.nz/~iam4
WAND Network Research Group
University of Waikato
New Zealand
^ permalink raw reply
* Re: KERNEL: assertion (!sk->sk_forward_alloc) failed
From: Boris B. Zhmurov @ 2006-02-09 19:32 UTC (permalink / raw)
To: Ian McDonald; +Cc: Jesse Brandeburg, Yoseph Basri, linux-kernel, NetDEV list
In-Reply-To: <cbec11ac0602091125w5a5a7c6em8462131e9f9b24dc@mail.gmail.com>
Hello, Ian McDonald.
On 09.02.2006 22:25 you said the following:
> Is it possible for you to download 2.6.16-rc2 or similar and see if it
> goes away?
It'll be better, if I get only patch fixs that problem, not all 2.6.16-rc2.
--
Boris B. Zhmurov
mailto: bb@kernelpanic.ru
"wget http://kernelpanic.ru/bb_public_key.pgp -O - | gpg --import"
^ permalink raw reply
* Re: KERNEL: assertion (!sk->sk_forward_alloc) failed
From: Ian McDonald @ 2006-02-09 19:25 UTC (permalink / raw)
To: bb; +Cc: Jesse Brandeburg, Yoseph Basri, linux-kernel, NetDEV list
In-Reply-To: <43EB9548.9060504@kernelpanic.ru>
On 2/10/06, Boris B. Zhmurov <bb@kernelpanic.ru> wrote:
> Hello, Jesse Brandeburg.
>
> On 08.02.2006 23:07 you said the following:
>
> > whats the relevance of e1000?
> >
> > I though Herbert had fixed these
>
> Nope :( I had this messages on 2.6.14.2 and now I have it on 2.6.15.3.
>
For what it's worth I had these messages for a while and they got
fixed 2 or 3 weeks ago from memory in Dave's 2.6.16 net tree or net2.6
tree.
Is it possible for you to download 2.6.16-rc2 or similar and see if it
goes away?
Ian
--
Ian McDonald
http://wand.net.nz/~iam4
WAND Network Research Group
University of Waikato
New Zealand
^ permalink raw reply
* Re: KERNEL: assertion (!sk->sk_forward_alloc) failed
From: Boris B. Zhmurov @ 2006-02-09 19:17 UTC (permalink / raw)
To: Jesse Brandeburg; +Cc: Yoseph Basri, linux-kernel, NetDEV list
In-Reply-To: <4807377b0602081207s7604eceahb8bf4af6715a6534@mail.gmail.com>
Hello, Jesse Brandeburg.
On 08.02.2006 23:07 you said the following:
> whats the relevance of e1000?
>
> I though Herbert had fixed these
Nope :( I had this messages on 2.6.14.2 and now I have it on 2.6.15.3.
--
Boris B. Zhmurov
mailto: bb@kernelpanic.ru
"wget http://kernelpanic.ru/bb_public_key.pgp -O - | gpg --import"
^ permalink raw reply
* Re: [PATCH] ppp: don't use 0 in pointer context
From: James Carlson @ 2006-02-09 13:15 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Alexey Dobriyan, Al Viro, netdev, linux-ppp
In-Reply-To: <17386.29792.87133.852682@cargo.ozlabs.ibm.com>
Paul Mackerras writes:
> > And the solution is to treat it as a boolean instead?! I'm not sure
> > which is more ugly.
> >
> > Why wouldn't explicit comparison against NULL be the preferred fix?
>
> I just think this whole "you shouldn't compare a pointer to 0" thing
> is completely silly,
Indeed.
> However, the head penguin seems to have some bee in his bonnet about 0
> not being a pointer value (despite what the C standard says), so
> whatever. *shrug*
Yeesh.
My point was that if you're going to get bent over something silly
like this, you might as well change it to something explicit, such as
a comparison of two pointers, rather than pretending that either
pointers or integers are in fact booleans.
I realize that it's entirely legal (per the standards) to write:
if (p)
as it is to write:
if (p != 0)
and also:
if (p != NULL)
But if we're actually interested in clarity, rather than passing some
woe-begotten lint-like purity test, only that third form actually says
what the code does. The other two may well be idiomatic in certain
circles, but they're nowhere near as lucid for those maintaining the
code.
I think that if this patch is "important," then something other than
just clarity is valued. In that case, just ignore me, and do what you
will.
--
James Carlson 42.703N 71.076W <carlsonj@workingcode.com>
^ permalink raw reply
* Re: KERNEL: assertion (!sk->sk_forward_alloc) failed
From: Jesse Brandeburg @ 2006-02-09 2:10 UTC (permalink / raw)
To: David S. Miller; +Cc: yoseph.basri, bb, linux-kernel, netdev
In-Reply-To: <20060208.141205.129707967.davem@davemloft.net>
On 2/8/06, David S. Miller <davem@davemloft.net> wrote:
> From: Jesse Brandeburg <jesse.brandeburg@gmail.com>
> Date: Wed, 8 Feb 2006 12:07:14 -0800
>
> > this should be on netdev (cc'd), i included some of the thread here.
> ...
> > I though Herbert had fixed these, and it looks like half the patches
> > got into 2.6.14.3, but not the fix to the fix committed on 9-6 (not in
> > 2.6.14.* at all)
>
> What are the changeset IDs so I can fix this?
I think the commit id that is missing from 2.6.14.X is
fb5f5e6e0cebd574be737334671d1aa8f170d5f3
but here is the web link if i gave the wrong info
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fb5f5e6e0cebd574be737334671d1aa8f170d5f3
^ permalink raw reply
* Re: [PATCH] ppp: don't use 0 in pointer context
From: Herbert Xu @ 2006-02-09 0:06 UTC (permalink / raw)
To: David S. Miller
Cc: adobriyan, dlstevens, carlsonj, linux-ppp, netdev, netdev-owner,
viro
In-Reply-To: <20060208.155859.82670094.davem@davemloft.net>
On Wed, Feb 08, 2006 at 03:58:59PM -0800, David S. Miller wrote:
> From: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Thu, 09 Feb 2006 10:49:37 +1100
>
> > The difference between gcc -pedantic and sparse is that it doesn't
> > warn about obviously correct cases like p != 0 or p = 0.
>
> So obviously correct that you left out an equals sign in the
> second case :-)
Actually I intended that to be an assignment as this is something that
has generated many sparse patches. Now if this was a comparison
mistakenly written as an assignment, gcc would pick it up anyway:
a.c:3: warning: suggest parentheses around assignment used as truth value
Cheers,
--
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
* Re: [PATCH] ppp: don't use 0 in pointer context
From: Randy.Dunlap @ 2006-02-09 0:05 UTC (permalink / raw)
To: David S. Miller
Cc: herbert, adobriyan, dlstevens, carlsonj, linux-ppp, netdev,
netdev-owner, viro
In-Reply-To: <20060208.155859.82670094.davem@davemloft.net>
On Wed, 8 Feb 2006, David S. Miller wrote:
> From: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Thu, 09 Feb 2006 10:49:37 +1100
>
> > The difference between gcc -pedantic and sparse is that it doesn't
> > warn about obviously correct cases like p != 0 or p = 0.
>
> So obviously correct that you left out an equals sign in the
> second case :-)
You should thank him. 8;)
--
~Randy
^ permalink raw reply
* Re: [PATCH] ppp: don't use 0 in pointer context
From: David S. Miller @ 2006-02-08 23:58 UTC (permalink / raw)
To: herbert
Cc: adobriyan, dlstevens, carlsonj, linux-ppp, netdev, netdev-owner,
viro
In-Reply-To: <E1F6z45-0006qL-00@gondolin.me.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu, 09 Feb 2006 10:49:37 +1100
> The difference between gcc -pedantic and sparse is that it doesn't
> warn about obviously correct cases like p != 0 or p = 0.
So obviously correct that you left out an equals sign in the
second case :-)
^ permalink raw reply
* Re: [PATCH] ppp: don't use 0 in pointer context
From: Herbert Xu @ 2006-02-08 23:49 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: dlstevens, herbert, carlsonj, linux-ppp, netdev, netdev-owner,
viro
In-Reply-To: <20060208232214.GC14543@mipter.zuzino.mipt.ru>
Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> Oh, and for the record: current sparse from Linus doesn't warn about
> this. Slightly modified sparse warns. Bugs which were uncovered by
> more or less trivial and slightly broken sparse patch [1] are:
>
> [PATCH] dscc4: fix dscc4_init_dummy_skb check
> [PATCH] opl3sa2: fix adding second dma channel
> [PATCH] gusclassic: fix adding second dma channel
> [PATCH] ipw2200: fix ->eeprom[EEPROM_VERSION] check
> [PATCH] ixj: fix writing silence check
The first two can also be caught with gcc -pedantic. In fact, catching
the last two should be doable there as well. The difference between
gcc -pedantic and sparse is that it doesn't warn about obviously correct
cases like p != 0 or p = 0.
Cheers,
--
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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox