two trivial PCMCIA patches [Was: three trivial PCMCIA patches]
Pavel Roskin
proski at gnu.org
Fri Apr 18 05:01:05 BST 2003
On Fri, 18 Apr 2003, Dominik Brodowski wrote:
> Hi Russell,
>
> As you already pushed the cardbus_lockups patch, could you please push the
> other two changes to Linus, too?
I got this message when I was going to send two more patches. Here they
are.
pcnet.diff - Use SET_MODULE_OWNER instead of obsolete MOD_INC_USE_COUNT
and MOD_DEC_USE_COUNT. Copying David Hinds as the maintainer.
release_io.diff - Fix for a very nasty bug when I/O resources are not
freed for sockets with static memory but relocatable I/O windows.
alloc_io_space() skips allocation only if both SS_CAP_STATIC_MAP and
io_offset are set. But release_io_space() only checks SS_CAP_STATIC_MAP.
I think that SS_CAP_STATIC_MAP and io_offset should be independent -
SS_CAP_STATIC_MAP for memory only, and io_offset for I/O only. That's
what the patch does. There are no other references to io_offset, so this
change of semantic (if SS_CAP_STATIC_MAP was meant to be checked) should
be safe.
--
Regards,
Pavel Roskin
-------------- next part --------------
--- linux.orig/drivers/pcmcia/cs.c
+++ linux/drivers/pcmcia/cs.c
@@ -818,7 +818,7 @@ static int alloc_io_space(socket_info_t
*base, align);
align = 0;
}
- if ((s->cap.features & SS_CAP_STATIC_MAP) && s->cap.io_offset) {
+ if (s->cap.io_offset) {
*base = s->cap.io_offset | (*base & 0x0fff);
return 0;
}
@@ -866,7 +866,7 @@ static void release_io_space(socket_info
ioaddr_t num)
{
int i;
- if(!(s->cap.features & SS_CAP_STATIC_MAP))
+ if(!s->cap.io_offset)
release_region(base, num);
for (i = 0; i < MAX_IO_WIN; i++) {
if ((s->io[i].BasePort <= base) &&
-------------- next part --------------
--- linux.orig/drivers/net/pcmcia/pcnet_cs.c
+++ linux/drivers/net/pcmcia/pcnet_cs.c
@@ -716,6 +720,8 @@ static void pcnet_config(dev_link_t *lin
goto failed;
}
+ SET_MODULE_OWNER(dev);
+
hw_info = get_hwinfo(link);
if (hw_info == NULL)
hw_info = get_prom(link);
@@ -1030,7 +1036,6 @@ static int pcnet_open(struct net_device
return -ENODEV;
link->open++;
- MOD_INC_USE_COUNT;
set_misc_reg(dev);
request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev);
@@ -1064,8 +1069,6 @@ static int pcnet_close(struct net_device
if (link->state & DEV_STALE_CONFIG)
mod_timer(&link->release, jiffies + HZ/20);
- MOD_DEC_USE_COUNT;
-
return 0;
} /* pcnet_close */
More information about the linux-pcmcia
mailing list