From 352dd1df32e672be4cff71132eb9c06a257872fe Mon Sep 17 00:00:00 2001 From: Brian Gerst Date: Tue, 27 Dec 2005 23:43:31 -0500 Subject: gitignore: misc files Ignore all files generated from *_shipped files, plus a few others. Signed-off-by: Brian Gerst Signed-off-by: Sam Ravnborg --- drivers/char/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/.gitignore b/drivers/char/.gitignore index 2b6b1d772ed..73dfdcebfbb 100644 --- a/drivers/char/.gitignore +++ b/drivers/char/.gitignore @@ -1,3 +1,3 @@ consolemap_deftbl.c defkeymap.c - +qtronixmap.c -- cgit From 4a4efbdee278b2f4ed91aad2db5c006ff754276e Mon Sep 17 00:00:00 2001 From: Matt Mackall Date: Tue, 3 Jan 2006 13:27:11 +0100 Subject: s/retreiv/retriev/g As everyone knows, the rule is: "i before e.. um.. always." Signed-off-by: Matt Mackall Signed-off-by: Adrian Bunk --- drivers/char/n_hdlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index c3660d8781a..a133a62f3d5 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c @@ -562,7 +562,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, } /* end of n_hdlc_tty_receive() */ /** - * n_hdlc_tty_read - Called to retreive one frame of data (if available) + * n_hdlc_tty_read - Called to retrieve one frame of data (if available) * @tty - pointer to tty instance data * @file - pointer to open file object * @buf - pointer to returned data buffer -- cgit From a7f5e7f164788a22eb5d3de8e2d3cee1bf58fdca Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 13 Dec 2005 23:25:31 -0800 Subject: [INET]: Generalise tcp_v4_hash_connect Renaming it to inet_hash_connect, making it possible to ditch dccp_v4_hash_connect and share the same code with TCP instead. Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- drivers/char/random.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/random.c b/drivers/char/random.c index 7999da25fe4..79b59d986af 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1554,10 +1554,8 @@ __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, EXPORT_SYMBOL(secure_tcp_sequence_number); - - -/* Generate secure starting point for ephemeral TCP port search */ -u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport) +/* Generate secure starting point for ephemeral IPV4 transport port search */ +u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport) { struct keydata *keyptr = get_keyptr(); u32 hash[4]; -- cgit From d8313f5ca2b1f86b7df6c99fc4b3fffa1f84e92b Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 13 Dec 2005 23:25:44 -0800 Subject: [INET6]: Generalise tcp_v6_hash_connect Renaming it to inet6_hash_connect, making it possible to ditch dccp_v6_hash_connect and share the same code with TCP instead. Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- drivers/char/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/random.c b/drivers/char/random.c index 79b59d986af..bdfdfd28594 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1573,7 +1573,7 @@ u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport) } #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport) +u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport) { struct keydata *keyptr = get_keyptr(); u32 hash[12]; @@ -1584,7 +1584,7 @@ u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dp return twothirdsMD4Transform(daddr, hash); } -EXPORT_SYMBOL(secure_tcpv6_port_ephemeral); +EXPORT_SYMBOL(secure_ipv6_port_ephemeral); #endif #if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) -- cgit From 75318d2d7cab77b14c5d3dbd5e69f2680a769e16 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 21 Nov 2005 14:53:03 -0800 Subject: [PATCH] USB: remove .owner field from struct usb_driver It is no longer needed, so let's remove it, saving a bit of memory. Signed-off-by: Greg Kroah-Hartman --- drivers/char/watchdog/pcwd_usb.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 092e9b13375..1533f56baa4 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c @@ -151,7 +151,6 @@ static void usb_pcwd_disconnect (struct usb_interface *interface); /* usb specific object needed to register this driver with the usb subsystem */ static struct usb_driver usb_pcwd_driver = { - .owner = THIS_MODULE, .name = DRIVER_NAME, .probe = usb_pcwd_probe, .disconnect = usb_pcwd_disconnect, -- cgit From a020ff412f0ecbb1e4aae1681b287e5785dd77b5 Mon Sep 17 00:00:00 2001 From: David Howells Date: Wed, 4 Jan 2006 18:01:03 +0000 Subject: [PATCH] Fix pragma packing in ip2 driver This fixes the pragma packing in the ip2 driver by popping the previous setting rather than explicitly assuming that the correct setting is 4. This also gets around a compiler bug in the FRV compiler when building allmodconfig. Signed-Off-By: David Howells Signed-off-by: Linus Torvalds --- drivers/char/ip2/i2pack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/ip2/i2pack.h b/drivers/char/ip2/i2pack.h index e9b87a78622..00342a677c9 100644 --- a/drivers/char/ip2/i2pack.h +++ b/drivers/char/ip2/i2pack.h @@ -358,7 +358,7 @@ typedef struct _failStat #define MB_OUT_STRIPPED 0x40 // Board has read all output from fifo #define MB_FATAL_ERROR 0x20 // Board has encountered a fatal error -#pragma pack(4) // Reset padding to command-line default +#pragma pack() // Reset padding to command-line default #endif // I2PACK_H -- cgit From 3adfd4e2b8804e926a5245062ba8ee12e88d30c3 Mon Sep 17 00:00:00 2001 From: Deepak Saxena Date: Tue, 3 Jan 2006 12:50:30 -0800 Subject: [PATCH] Fix IXP4xx watchdog errata workaround The IXP4xx driver bails out on all A0 CPUs, but it should only do so on IXP42x as IXP46x has functioning HW. Signed-off-by: Deepak Saxena Signed-off-by: Linus Torvalds --- drivers/char/watchdog/ixp4xx_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c index b5be8b11104..3800835ca8f 100644 --- a/drivers/char/watchdog/ixp4xx_wdt.c +++ b/drivers/char/watchdog/ixp4xx_wdt.c @@ -186,8 +186,8 @@ static int __init ixp4xx_wdt_init(void) unsigned long processor_id; asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :); - if (!(processor_id & 0xf)) { - printk("IXP4XXX Watchdog: Rev. A0 CPU detected - " + if (!(processor_id & 0xf) && !cpu_is_ixp46x()) { + printk("IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected - " "watchdog disabled\n"); return -ENODEV; -- cgit From 98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 14 Nov 2005 21:21:18 +0100 Subject: [PATCH] pcmcia: new suspend core Move the suspend and resume methods out of the event handler, and into special functions. Also use these functions for pre- and post-reset, as almost all drivers already do, and the remaining ones can easily be converted. Bugfix to include/pcmcia/ds.c Signed-off-by: Andrew Morton Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/cm4000_cs.c | 61 ++++++++++++++++++++++----------------- drivers/char/pcmcia/cm4040_cs.c | 50 ++++++++++++++++---------------- drivers/char/pcmcia/synclink_cs.c | 47 ++++++++++++++++++------------ 3 files changed, 88 insertions(+), 70 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 61681c9f3f7..05e93054c98 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1893,33 +1893,6 @@ static int cm4000_event(event_t event, int priority, link->state &= ~DEV_PRESENT; stop_monitor(dev); break; - case CS_EVENT_PM_SUSPEND: - DEBUGP(5, dev, "CS_EVENT_PM_SUSPEND " - "(fall-through to CS_EVENT_RESET_PHYSICAL)\n"); - link->state |= DEV_SUSPEND; - /* fall-through */ - case CS_EVENT_RESET_PHYSICAL: - DEBUGP(5, dev, "CS_EVENT_RESET_PHYSICAL\n"); - if (link->state & DEV_CONFIG) { - DEBUGP(5, dev, "ReleaseConfiguration\n"); - pcmcia_release_configuration(link->handle); - } - stop_monitor(dev); - break; - case CS_EVENT_PM_RESUME: - DEBUGP(5, dev, "CS_EVENT_PM_RESUME " - "(fall-through to CS_EVENT_CARD_RESET)\n"); - link->state &= ~DEV_SUSPEND; - /* fall-through */ - case CS_EVENT_CARD_RESET: - DEBUGP(5, dev, "CS_EVENT_CARD_RESET\n"); - if ((link->state & DEV_CONFIG)) { - DEBUGP(5, dev, "RequestConfiguration\n"); - pcmcia_request_configuration(link->handle, &link->conf); - } - if (link->open) - start_monitor(dev); - break; default: DEBUGP(5, dev, "unknown event %.2x\n", event); break; @@ -1928,6 +1901,38 @@ static int cm4000_event(event_t event, int priority, return CS_SUCCESS; } +static int cm4000_suspend(struct pcmcia_device *p_dev) +{ + dev_link_t *link = dev_to_instance(p_dev); + struct cm4000_dev *dev; + + dev = link->priv; + + link->state |= DEV_SUSPEND; + if (link->state & DEV_CONFIG) + pcmcia_release_configuration(link->handle); + stop_monitor(dev); + + return 0; +} + +static int cm4000_resume(struct pcmcia_device *p_dev) +{ + dev_link_t *link = dev_to_instance(p_dev); + struct cm4000_dev *dev; + + dev = link->priv; + + link->state &= ~DEV_SUSPEND; + if (link->state & DEV_CONFIG) + pcmcia_request_configuration(link->handle, &link->conf); + + if (link->open) + start_monitor(dev); + + return 0; +} + static void cm4000_release(dev_link_t *link) { cmm_cm4000_release(link->priv); /* delay release until device closed */ @@ -2044,6 +2049,8 @@ static struct pcmcia_driver cm4000_driver = { }, .attach = cm4000_attach, .detach = cm4000_detach, + .suspend = cm4000_suspend, + .resume = cm4000_resume, .event = cm4000_event, .id_table = cm4000_ids, }; diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 4c698d908ff..3622fd39c47 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -656,31 +656,7 @@ static int reader_event(event_t event, int priority, DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n"); link->state &= ~DEV_PRESENT; break; - case CS_EVENT_PM_SUSPEND: - DEBUGP(5, dev, "CS_EVENT_PM_SUSPEND " - "(fall-through to CS_EVENT_RESET_PHYSICAL)\n"); - link->state |= DEV_SUSPEND; - - case CS_EVENT_RESET_PHYSICAL: - DEBUGP(5, dev, "CS_EVENT_RESET_PHYSICAL\n"); - if (link->state & DEV_CONFIG) { - DEBUGP(5, dev, "ReleaseConfiguration\n"); - pcmcia_release_configuration(link->handle); - } - break; - case CS_EVENT_PM_RESUME: - DEBUGP(5, dev, "CS_EVENT_PM_RESUME " - "(fall-through to CS_EVENT_CARD_RESET)\n"); - link->state &= ~DEV_SUSPEND; - - case CS_EVENT_CARD_RESET: - DEBUGP(5, dev, "CS_EVENT_CARD_RESET\n"); - if ((link->state & DEV_CONFIG)) { - DEBUGP(5, dev, "RequestConfiguration\n"); - pcmcia_request_configuration(link->handle, - &link->conf); - } - break; + default: DEBUGP(5, dev, "reader_event: unknown event %.2x\n", event); @@ -690,6 +666,28 @@ static int reader_event(event_t event, int priority, return CS_SUCCESS; } +static int reader_suspend(struct pcmcia_device *p_dev) +{ + dev_link_t *link = dev_to_instance(p_dev); + + link->state |= DEV_SUSPEND; + if (link->state & DEV_CONFIG) + pcmcia_release_configuration(link->handle); + + return 0; +} + +static int reader_resume(struct pcmcia_device *p_dev) +{ + dev_link_t *link = dev_to_instance(p_dev); + + link->state &= ~DEV_SUSPEND; + if (link->state & DEV_CONFIG) + pcmcia_request_configuration(link->handle, &link->conf); + + return 0; +} + static void reader_release(dev_link_t *link) { cm4040_reader_release(link->priv); @@ -806,6 +804,8 @@ static struct pcmcia_driver reader_driver = { }, .attach = reader_attach, .detach = reader_detach, + .suspend = reader_suspend, + .resume = reader_resume, .event = reader_event, .id_table = cm4040_ids, }; diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 2c326ea5342..776103e5604 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -773,11 +773,37 @@ static void mgslpc_detach(dev_link_t *link) mgslpc_remove_device((MGSLPC_INFO *)link->priv); } +static int mgslpc_suspend(struct pcmcia_device *dev) +{ + dev_link_t *link = dev_to_instance(dev); + MGSLPC_INFO *info = link->priv; + + link->state |= DEV_SUSPEND; + info->stop = 1; + if (link->state & DEV_CONFIG) + pcmcia_release_configuration(link->handle); + + return 0; +} + +static int mgslpc_resume(struct pcmcia_device *dev) +{ + dev_link_t *link = dev_to_instance(dev); + MGSLPC_INFO *info = link->priv; + + link->state &= ~DEV_SUSPEND; + if (link->state & DEV_CONFIG) + pcmcia_request_configuration(link->handle, &link->conf); + info->stop = 0; + + return 0; +} + + static int mgslpc_event(event_t event, int priority, event_callback_args_t *args) { dev_link_t *link = args->client_data; - MGSLPC_INFO *info = link->priv; if (debug_level >= DEBUG_LEVEL_INFO) printk("mgslpc_event(0x%06x)\n", event); @@ -794,23 +820,6 @@ static int mgslpc_event(event_t event, int priority, link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; mgslpc_config(link); break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - /* Mark the device as stopped, to block IO until later */ - info->stop = 1; - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (link->state & DEV_CONFIG) - pcmcia_request_configuration(link->handle, &link->conf); - info->stop = 0; - break; } return 0; } @@ -3095,6 +3104,8 @@ static struct pcmcia_driver mgslpc_driver = { .event = mgslpc_event, .detach = mgslpc_detach, .id_table = mgslpc_ids, + .suspend = mgslpc_suspend, + .resume = mgslpc_resume, }; static struct tty_operations mgslpc_ops = { -- cgit From cc3b4866bee996c922e875b8c8efe9f0d8803aae Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 14 Nov 2005 21:23:14 +0100 Subject: [PATCH] pcmcia: unify detach, REMOVAL_EVENT handlers into one remove callback Unify the "detach" and REMOVAL_EVENT handlers to one "remove" function. Old functionality is preserved, for the moment. Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/cm4000_cs.c | 55 ++++++++++++--------------------------- drivers/char/pcmcia/cm4040_cs.c | 52 ++++++++++++------------------------ drivers/char/pcmcia/synclink_cs.c | 34 ++++++------------------ 3 files changed, 42 insertions(+), 99 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 05e93054c98..8a064f2f005 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -66,7 +66,7 @@ static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte"; #define T_100MSEC msecs_to_jiffies(100) #define T_500MSEC msecs_to_jiffies(500) -static void cm4000_detach(dev_link_t *link); +static void cm4000_detach(struct pcmcia_device *p_dev); static void cm4000_release(dev_link_t *link); static int major; /* major number we get from the kernel */ @@ -1888,11 +1888,6 @@ static int cm4000_event(event_t event, int priority, link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; cm4000_config(link, devno); break; - case CS_EVENT_CARD_REMOVAL: - DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n"); - link->state &= ~DEV_PRESENT; - stop_monitor(dev); - break; default: DEBUGP(5, dev, "unknown event %.2x\n", event); break; @@ -1978,7 +1973,7 @@ static dev_link_t *cm4000_attach(void) i = pcmcia_register_client(&link->handle, &client_reg); if (i) { cs_error(link->handle, RegisterClient, i); - cm4000_detach(link); + cm4000_detach(link->handle); return NULL; } @@ -1990,39 +1985,28 @@ static dev_link_t *cm4000_attach(void) return link; } -static void cm4000_detach_by_devno(int devno, dev_link_t * link) +static void cm4000_detach(struct pcmcia_device *p_dev) { + dev_link_t *link = dev_to_instance(p_dev); struct cm4000_dev *dev = link->priv; + int devno; - DEBUGP(3, dev, "-> detach_by_devno(devno=%d)\n", devno); + /* find device */ + for (devno = 0; devno < CM4000_MAX_DEV; devno++) + if (dev_table[devno] == link) + break; + if (devno == CM4000_MAX_DEV) + return; - if (link->state & DEV_CONFIG) { - DEBUGP(5, dev, "device still configured (try to release it)\n"); - cm4000_release(link); - } + link->state &= ~DEV_PRESENT; + stop_monitor(dev); - if (link->handle) { - pcmcia_deregister_client(link->handle); - } + if (link->state & DEV_CONFIG) + cm4000_release(link); dev_table[devno] = NULL; - kfree(dev); - return; -} - -static void cm4000_detach(dev_link_t * link) -{ - int i; + kfree(dev); - /* find device */ - for (i = 0; i < CM4000_MAX_DEV; i++) - if (dev_table[i] == link) - break; - - if (i == CM4000_MAX_DEV) - return; - - cm4000_detach_by_devno(i, link); return; } @@ -2048,7 +2032,7 @@ static struct pcmcia_driver cm4000_driver = { .name = "cm4000_cs", }, .attach = cm4000_attach, - .detach = cm4000_detach, + .remove = cm4000_detach, .suspend = cm4000_suspend, .resume = cm4000_resume, .event = cm4000_event, @@ -2071,13 +2055,8 @@ static int __init cmm_init(void) static void __exit cmm_exit(void) { - int i; - printk(KERN_INFO MODULE_NAME ": unloading\n"); pcmcia_unregister_driver(&cm4000_driver); - for (i = 0; i < CM4000_MAX_DEV; i++) - if (dev_table[i]) - cm4000_detach_by_devno(i, dev_table[i]); unregister_chrdev(major, DEVICE_NAME); }; diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 3622fd39c47..e08ab949c11 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -65,7 +65,7 @@ static char *version = #define POLL_PERIOD msecs_to_jiffies(10) static void reader_release(dev_link_t *link); -static void reader_detach(dev_link_t *link); +static void reader_detach(struct pcmcia_device *p_dev); static int major; @@ -652,10 +652,6 @@ static int reader_event(event_t event, int priority, link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; reader_config(link, devno); break; - case CS_EVENT_CARD_REMOVAL: - DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n"); - link->state &= ~DEV_PRESENT; - break; default: DEBUGP(5, dev, "reader_event: unknown event %.2x\n", @@ -734,7 +730,7 @@ static dev_link_t *reader_attach(void) i = pcmcia_register_client(&link->handle, &client_reg); if (i) { cs_error(link->handle, RegisterClient, i); - reader_detach(link); + reader_detach(link->handle); return NULL; } init_waitqueue_head(&dev->devq); @@ -747,36 +743,28 @@ static dev_link_t *reader_attach(void) return link; } -static void reader_detach_by_devno(int devno, dev_link_t *link) +static void reader_detach(struct pcmcia_device *p_dev) { + dev_link_t *link = dev_to_instance(p_dev); struct reader_dev *dev = link->priv; - - if (link->state & DEV_CONFIG) { - DEBUGP(5, dev, "device still configured (try to release it)\n"); - reader_release(link); - } - - pcmcia_deregister_client(link->handle); - dev_table[devno] = NULL; - DEBUGP(5, dev, "freeing dev=%p\n", dev); - cm4040_stop_poll(dev); - kfree(dev); - return; -} - -static void reader_detach(dev_link_t *link) -{ - int i; + int devno; /* find device */ - for (i = 0; i < CM_MAX_DEV; i++) { - if (dev_table[i] == link) + for (devno = 0; devno < CM_MAX_DEV; devno++) { + if (dev_table[devno] == link) break; } - if (i == CM_MAX_DEV) + if (devno == CM_MAX_DEV) return; - reader_detach_by_devno(i, link); + link->state &= ~DEV_PRESENT; + + if (link->state & DEV_CONFIG) + reader_release(link); + + dev_table[devno] = NULL; + kfree(dev); + return; } @@ -803,7 +791,7 @@ static struct pcmcia_driver reader_driver = { .name = "cm4040_cs", }, .attach = reader_attach, - .detach = reader_detach, + .remove = reader_detach, .suspend = reader_suspend, .resume = reader_resume, .event = reader_event, @@ -825,14 +813,8 @@ static int __init cm4040_init(void) static void __exit cm4040_exit(void) { - int i; - printk(KERN_INFO MODULE_NAME ": unloading\n"); pcmcia_unregister_driver(&reader_driver); - for (i = 0; i < CM_MAX_DEV; i++) { - if (dev_table[i]) - reader_detach_by_devno(i, dev_table[i]); - } unregister_chrdev(major, DEVICE_NAME); } diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 776103e5604..34597144d9c 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -489,7 +489,7 @@ static void mgslpc_release(u_long arg); static int mgslpc_event(event_t event, int priority, event_callback_args_t *args); static dev_link_t *mgslpc_attach(void); -static void mgslpc_detach(dev_link_t *); +static void mgslpc_detach(struct pcmcia_device *p_dev); static dev_info_t dev_info = "synclink_cs"; static dev_link_t *dev_list = NULL; @@ -598,7 +598,7 @@ static dev_link_t *mgslpc_attach(void) ret = pcmcia_register_client(&link->handle, &client_reg); if (ret != CS_SUCCESS) { cs_error(link->handle, RegisterClient, ret); - mgslpc_detach(link); + mgslpc_detach(link->handle); return NULL; } @@ -736,17 +736,16 @@ static void mgslpc_release(u_long arg) pcmcia_release_io(link->handle, &link->io); if (link->irq.AssignedIRQ) pcmcia_release_irq(link->handle, &link->irq); - if (link->state & DEV_STALE_LINK) - mgslpc_detach(link); } -static void mgslpc_detach(dev_link_t *link) +static void mgslpc_detach(struct pcmcia_device *p_dev) { + dev_link_t *link = dev_to_instance(p_dev); dev_link_t **linkp; if (debug_level >= DEBUG_LEVEL_INFO) printk("mgslpc_detach(0x%p)\n", link); - + /* find device */ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) if (*linkp == link) break; @@ -754,20 +753,10 @@ static void mgslpc_detach(dev_link_t *link) return; if (link->state & DEV_CONFIG) { - /* device is configured/active, mark it so when - * release() is called a proper detach() occurs. - */ - if (debug_level >= DEBUG_LEVEL_INFO) - printk(KERN_DEBUG "synclinkpc: detach postponed, '%s' " - "still locked\n", link->dev->dev_name); - link->state |= DEV_STALE_LINK; - return; + ((MGSLPC_INFO *)link->priv)->stop = 1; + mgslpc_release((u_long)link); } - /* Break the link with Card Services */ - if (link->handle) - pcmcia_deregister_client(link->handle); - /* Unlink device structure, and free it */ *linkp = link->next; mgslpc_remove_device((MGSLPC_INFO *)link->priv); @@ -809,13 +798,6 @@ static int mgslpc_event(event_t event, int priority, printk("mgslpc_event(0x%06x)\n", event); switch (event) { - case CS_EVENT_CARD_REMOVAL: - link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) { - ((MGSLPC_INFO *)link->priv)->stop = 1; - mgslpc_release((u_long)link); - } - break; case CS_EVENT_CARD_INSERTION: link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; mgslpc_config(link); @@ -3102,7 +3084,7 @@ static struct pcmcia_driver mgslpc_driver = { }, .attach = mgslpc_attach, .event = mgslpc_event, - .detach = mgslpc_detach, + .remove = mgslpc_detach, .id_table = mgslpc_ids, .suspend = mgslpc_suspend, .resume = mgslpc_resume, -- cgit From b463581154f3f3eecda27cae60df813fefcd84d3 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 14 Nov 2005 21:25:35 +0100 Subject: [PATCH] pcmcia: remove dev_list from drivers The linked list of devices managed by each PCMCIA driver is, in very most cases, unused. Therefore, remove it from many drivers. Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/synclink_cs.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 34597144d9c..dc38b1d0a72 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -492,7 +492,6 @@ static dev_link_t *mgslpc_attach(void); static void mgslpc_detach(struct pcmcia_device *p_dev); static dev_info_t dev_info = "synclink_cs"; -static dev_link_t *dev_list = NULL; /* * 1st function defined in .text section. Calling this function in @@ -588,8 +587,7 @@ static dev_link_t *mgslpc_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; /* Register with Card Services */ - link->next = dev_list; - dev_list = link; + link->next = NULL; client_reg.dev_info = &dev_info; client_reg.Version = 0x0210; @@ -741,24 +739,15 @@ static void mgslpc_release(u_long arg) static void mgslpc_detach(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); - dev_link_t **linkp; if (debug_level >= DEBUG_LEVEL_INFO) printk("mgslpc_detach(0x%p)\n", link); - /* find device */ - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) - if (*linkp == link) break; - if (*linkp == NULL) - return; - if (link->state & DEV_CONFIG) { ((MGSLPC_INFO *)link->priv)->stop = 1; mgslpc_release((u_long)link); } - /* Unlink device structure, and free it */ - *linkp = link->next; mgslpc_remove_device((MGSLPC_INFO *)link->priv); } @@ -3131,7 +3120,6 @@ static void synclink_cs_cleanup(void) } pcmcia_unregister_driver(&mgslpc_driver); - BUG_ON(dev_list != NULL); } static int __init synclink_cs_init(void) -- cgit From f8cfa618dccbdc6dab5297f75779566a388a98fd Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 14 Nov 2005 21:25:51 +0100 Subject: [PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified probe() callback. As all in-kernel drivers are changed to this new callback, there will be no temporary backwards-compatibility. Inside a probe() function, each driver _must_ set struct pcmcia_device *p_dev->instance and instance->handle correctly. With these patches, the basic driver interface for 16-bit PCMCIA drivers now has the classic four callbacks known also from other buses: int (*probe) (struct pcmcia_device *dev); void (*remove) (struct pcmcia_device *dev); int (*suspend) (struct pcmcia_device *dev); int (*resume) (struct pcmcia_device *dev); Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/cm4000_cs.c | 68 +++++++-------------------------------- drivers/char/pcmcia/cm4040_cs.c | 67 +++++++------------------------------- drivers/char/pcmcia/synclink_cs.c | 49 +++++----------------------- 3 files changed, 30 insertions(+), 154 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 8a064f2f005..649677b5dc3 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -66,7 +66,6 @@ static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte"; #define T_100MSEC msecs_to_jiffies(100) #define T_500MSEC msecs_to_jiffies(500) -static void cm4000_detach(struct pcmcia_device *p_dev); static void cm4000_release(dev_link_t *link); static int major; /* major number we get from the kernel */ @@ -156,7 +155,6 @@ struct cm4000_dev { /*sbuf*/ 512*sizeof(char) - \ /*queue*/ 4*sizeof(wait_queue_head_t)) -static dev_info_t dev_info = MODULE_NAME; static dev_link_t *dev_table[CM4000_MAX_DEV]; /* This table doesn't use spaces after the comma between fields and thus @@ -1864,38 +1862,6 @@ cs_release: link->state &= ~DEV_CONFIG_PENDING; } -static int cm4000_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link; - struct cm4000_dev *dev; - int devno; - - link = args->client_data; - dev = link->priv; - - DEBUGP(3, dev, "-> cm4000_event\n"); - for (devno = 0; devno < CM4000_MAX_DEV; devno++) - if (dev_table[devno] == link) - break; - - if (devno == CM4000_MAX_DEV) - return CS_BAD_ADAPTER; - - switch (event) { - case CS_EVENT_CARD_INSERTION: - DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n"); - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - cm4000_config(link, devno); - break; - default: - DEBUGP(5, dev, "unknown event %.2x\n", event); - break; - } - DEBUGP(3, dev, "<- cm4000_event\n"); - return CS_SUCCESS; -} - static int cm4000_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -1935,11 +1901,10 @@ static void cm4000_release(dev_link_t *link) pcmcia_release_io(link->handle, &link->io); } -static dev_link_t *cm4000_attach(void) +static int cm4000_attach(struct pcmcia_device *p_dev) { struct cm4000_dev *dev; dev_link_t *link; - client_reg_t client_reg; int i; for (i = 0; i < CM4000_MAX_DEV; i++) @@ -1948,41 +1913,31 @@ static dev_link_t *cm4000_attach(void) if (i == CM4000_MAX_DEV) { printk(KERN_NOTICE MODULE_NAME ": all devices in use\n"); - return NULL; + return -ENODEV; } /* create a new cm4000_cs device */ dev = kzalloc(sizeof(struct cm4000_dev), GFP_KERNEL); if (dev == NULL) - return NULL; + return -ENOMEM; link = &dev->link; link->priv = dev; link->conf.IntType = INT_MEMORY_AND_IO; dev_table[i] = link; - /* register with card services */ - client_reg.dev_info = &dev_info; - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - - i = pcmcia_register_client(&link->handle, &client_reg); - if (i) { - cs_error(link->handle, RegisterClient, i); - cm4000_detach(link->handle); - return NULL; - } - init_waitqueue_head(&dev->devq); init_waitqueue_head(&dev->ioq); init_waitqueue_head(&dev->atrq); init_waitqueue_head(&dev->readq); - return link; + link->handle = p_dev; + p_dev->instance = link; + + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; + cm4000_config(link, i); + + return 0; } static void cm4000_detach(struct pcmcia_device *p_dev) @@ -2031,11 +1986,10 @@ static struct pcmcia_driver cm4000_driver = { .drv = { .name = "cm4000_cs", }, - .attach = cm4000_attach, + .probe = cm4000_attach, .remove = cm4000_detach, .suspend = cm4000_suspend, .resume = cm4000_resume, - .event = cm4000_event, .id_table = cm4000_ids, }; diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index e08ab949c11..46eb371bf17 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -65,7 +65,6 @@ static char *version = #define POLL_PERIOD msecs_to_jiffies(10) static void reader_release(dev_link_t *link); -static void reader_detach(struct pcmcia_device *p_dev); static int major; @@ -86,7 +85,6 @@ struct reader_dev { struct timer_list poll_timer; }; -static dev_info_t dev_info = MODULE_NAME; static dev_link_t *dev_table[CM_MAX_DEV]; #ifndef PCMCIA_DEBUG @@ -629,39 +627,6 @@ cs_release: link->state &= ~DEV_CONFIG_PENDING; } -static int reader_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link; - struct reader_dev *dev; - int devno; - - link = args->client_data; - dev = link->priv; - DEBUGP(3, dev, "-> reader_event\n"); - for (devno = 0; devno < CM_MAX_DEV; devno++) { - if (dev_table[devno] == link) - break; - } - if (devno == CM_MAX_DEV) - return CS_BAD_ADAPTER; - - switch (event) { - case CS_EVENT_CARD_INSERTION: - DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n"); - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - reader_config(link, devno); - break; - - default: - DEBUGP(5, dev, "reader_event: unknown event %.2x\n", - event); - break; - } - DEBUGP(3, dev, "<- reader_event\n"); - return CS_SUCCESS; -} - static int reader_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -691,11 +656,10 @@ static void reader_release(dev_link_t *link) pcmcia_release_io(link->handle, &link->io); } -static dev_link_t *reader_attach(void) +static int reader_attach(struct pcmcia_device *p_dev) { struct reader_dev *dev; dev_link_t *link; - client_reg_t client_reg; int i; for (i = 0; i < CM_MAX_DEV; i++) { @@ -704,11 +668,11 @@ static dev_link_t *reader_attach(void) } if (i == CM_MAX_DEV) - return NULL; + return -ENODEV; dev = kzalloc(sizeof(struct reader_dev), GFP_KERNEL); if (dev == NULL) - return NULL; + return -ENOMEM; dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; dev->buffer_status = 0; @@ -719,20 +683,6 @@ static dev_link_t *reader_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; dev_table[i] = link; - client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - client_reg.EventMask= - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - i = pcmcia_register_client(&link->handle, &client_reg); - if (i) { - cs_error(link->handle, RegisterClient, i); - reader_detach(link->handle); - return NULL; - } init_waitqueue_head(&dev->devq); init_waitqueue_head(&dev->poll_wait); init_waitqueue_head(&dev->read_wait); @@ -740,7 +690,13 @@ static dev_link_t *reader_attach(void) init_timer(&dev->poll_timer); dev->poll_timer.function = &cm4040_do_poll; - return link; + link->handle = p_dev; + p_dev->instance = link; + + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; + reader_config(link, i); + + return 0; } static void reader_detach(struct pcmcia_device *p_dev) @@ -790,11 +746,10 @@ static struct pcmcia_driver reader_driver = { .drv = { .name = "cm4040_cs", }, - .attach = reader_attach, + .probe = reader_attach, .remove = reader_detach, .suspend = reader_suspend, .resume = reader_resume, - .event = reader_event, .id_table = cm4040_ids, }; diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index dc38b1d0a72..cf45b100eff 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -486,13 +486,8 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout); static void mgslpc_config(dev_link_t *link); static void mgslpc_release(u_long arg); -static int mgslpc_event(event_t event, int priority, - event_callback_args_t *args); -static dev_link_t *mgslpc_attach(void); static void mgslpc_detach(struct pcmcia_device *p_dev); -static dev_info_t dev_info = "synclink_cs"; - /* * 1st function defined in .text section. Calling this function in * init_module() followed by a breakpoint allows a remote debugger @@ -538,12 +533,10 @@ static void ldisc_receive_buf(struct tty_struct *tty, } } -static dev_link_t *mgslpc_attach(void) +static int mgslpc_attach(struct pcmcia_device *p_dev) { MGSLPC_INFO *info; dev_link_t *link; - client_reg_t client_reg; - int ret; if (debug_level >= DEBUG_LEVEL_INFO) printk("mgslpc_attach\n"); @@ -551,7 +544,7 @@ static dev_link_t *mgslpc_attach(void) info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); if (!info) { printk("Error can't allocate device instance data\n"); - return NULL; + return -ENOMEM; } memset(info, 0, sizeof(MGSLPC_INFO)); @@ -586,23 +579,15 @@ static dev_link_t *mgslpc_attach(void) link->conf.Vcc = 50; link->conf.IntType = INT_MEMORY_AND_IO; - /* Register with Card Services */ - link->next = NULL; - - client_reg.dev_info = &dev_info; - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; + link->handle = p_dev; + p_dev->instance = link; - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - mgslpc_detach(link->handle); - return NULL; - } + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; + mgslpc_config(link); mgslpc_add_device(info); - return link; + return 0; } /* Card has been inserted. @@ -778,23 +763,6 @@ static int mgslpc_resume(struct pcmcia_device *dev) } -static int mgslpc_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link = args->client_data; - - if (debug_level >= DEBUG_LEVEL_INFO) - printk("mgslpc_event(0x%06x)\n", event); - - switch (event) { - case CS_EVENT_CARD_INSERTION: - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - mgslpc_config(link); - break; - } - return 0; -} - static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, char *name, const char *routine) { @@ -3071,8 +3039,7 @@ static struct pcmcia_driver mgslpc_driver = { .drv = { .name = "synclink_cs", }, - .attach = mgslpc_attach, - .event = mgslpc_event, + .probe = mgslpc_attach, .remove = mgslpc_detach, .id_table = mgslpc_ids, .suspend = mgslpc_suspend, -- cgit From a7a4ad0998dcd682f4968e8ec5fc1259914a1c4a Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Fri, 6 Jan 2006 00:12:15 -0800 Subject: [PATCH] Geode LX HW RNG Support Add support to hw_random for the Geode LX HRNG device. Signed-off-by: Jordan Crouse Cc: Alan Cox Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/hw_random.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c index 6f673d2de0b..49769f59ea1 100644 --- a/drivers/char/hw_random.c +++ b/drivers/char/hw_random.c @@ -1,4 +1,9 @@ /* + Added support for the AMD Geode LX RNG + (c) Copyright 2004-2005 Advanced Micro Devices, Inc. + + derived from + Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) (c) Copyright 2003 Red Hat Inc @@ -95,6 +100,11 @@ static unsigned int via_data_present (void); static u32 via_data_read (void); #endif +static int __init geode_init(struct pci_dev *dev); +static void geode_cleanup(void); +static unsigned int geode_data_present (void); +static u32 geode_data_read (void); + struct rng_operations { int (*init) (struct pci_dev *dev); void (*cleanup) (void); @@ -122,6 +132,7 @@ enum { rng_hw_intel, rng_hw_amd, rng_hw_via, + rng_hw_geode, }; static struct rng_operations rng_vendor_ops[] = { @@ -139,6 +150,9 @@ static struct rng_operations rng_vendor_ops[] = { /* rng_hw_via */ { via_init, via_cleanup, via_data_present, via_data_read, 1 }, #endif + + /* rng_hw_geode */ + { geode_init, geode_cleanup, geode_data_present, geode_data_read, 4 } }; /* @@ -159,6 +173,9 @@ static struct pci_device_id rng_pci_tbl[] = { { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, + { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LX_AES, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_geode }, + { 0, }, /* terminate list */ }; MODULE_DEVICE_TABLE (pci, rng_pci_tbl); @@ -460,6 +477,57 @@ static void via_cleanup(void) } #endif +/*********************************************************************** + * + * AMD Geode RNG operations + * + */ + +static void __iomem *geode_rng_base = NULL; + +#define GEODE_RNG_DATA_REG 0x50 +#define GEODE_RNG_STATUS_REG 0x54 + +static u32 geode_data_read(void) +{ + u32 val; + + assert(geode_rng_base != NULL); + val = readl(geode_rng_base + GEODE_RNG_DATA_REG); + return val; +} + +static unsigned int geode_data_present(void) +{ + u32 val; + + assert(geode_rng_base != NULL); + val = readl(geode_rng_base + GEODE_RNG_STATUS_REG); + return val; +} + +static void geode_cleanup(void) +{ + iounmap(geode_rng_base); + geode_rng_base = NULL; +} + +static int geode_init(struct pci_dev *dev) +{ + unsigned long rng_base = pci_resource_start(dev, 0); + + if (rng_base == 0) + return 1; + + geode_rng_base = ioremap(rng_base, 0x58); + + if (geode_rng_base == NULL) { + printk(KERN_ERR PFX "Cannot ioremap RNG memory\n"); + return -EBUSY; + } + + return 0; +} /*********************************************************************** * @@ -574,7 +642,7 @@ static int __init rng_init (void) DPRINTK ("ENTER\n"); - /* Probe for Intel, AMD RNGs */ + /* Probe for Intel, AMD, Geode RNGs */ for_each_pci_dev(pdev) { ent = pci_match_id(rng_pci_tbl, pdev); if (ent) { -- cgit From 347a8dc3b815f0c0fa62a1df075184ffe4cbdcf1 Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky Date: Fri, 6 Jan 2006 00:19:28 -0800 Subject: [PATCH] s390: cleanup Kconfig Sanitize some s390 Kconfig options. We have ARCH_S390, ARCH_S390X, ARCH_S390_31, 64BIT, S390_SUPPORT and COMPAT. Replace these 6 options by S390, 64BIT and COMPAT. Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/Kconfig | 2 +- drivers/char/hangcheck-timer.c | 2 +- drivers/char/watchdog/Kconfig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 84e68cdd451..5ebd06b1b4c 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -985,7 +985,7 @@ config HPET_MMAP config HANGCHECK_TIMER tristate "Hangcheck timer" - depends on X86 || IA64 || PPC64 || ARCH_S390 + depends on X86 || IA64 || PPC64 || S390 help The hangcheck-timer module detects when the system has gone out to lunch past a certain margin. It can reboot the system diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c index 66e53dd450f..40a67c86420 100644 --- a/drivers/char/hangcheck-timer.c +++ b/drivers/char/hangcheck-timer.c @@ -120,7 +120,7 @@ __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks); #if defined(CONFIG_X86) # define HAVE_MONOTONIC # define TIMER_FREQ 1000000000ULL -#elif defined(CONFIG_ARCH_S390) +#elif defined(CONFIG_S390) /* FA240000 is 1 Second in the IBM time universe (Page 4-38 Principles of Op for zSeries */ # define TIMER_FREQ 0xFA240000ULL #elif defined(CONFIG_IA64) diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index 344001b45af..a6544790af6 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig @@ -438,7 +438,7 @@ config INDYDOG config ZVM_WATCHDOG tristate "z/VM Watchdog Timer" - depends on WATCHDOG && ARCH_S390 + depends on WATCHDOG && S390 help IBM s/390 and zSeries machines running under z/VM 5.1 or later provide a virtual watchdog timer to their guest that cause a -- cgit From 066bb8d03b6e52e4844d37145573d6a2bedaa339 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Fri, 6 Jan 2006 00:19:53 -0800 Subject: [PATCH] fix remaining list_for_each_safe_rcu in -mm (take 2) I missed a use of list_for_each_rcu_safe() in -mm tree. Here is an updated patch to fix it. This time tested on a machine that actually uses IPMI... (Thanks to Serge Hallyn for spotting this.) Signed-off-by: "Paul E. McKenney" Cc: Corey Minyard Cc: Matt Domsch Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/ipmi/ipmi_msghandler.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 1f56b4cf0f5..561430ed94a 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -787,7 +787,6 @@ int ipmi_destroy_user(ipmi_user_t user) int i; unsigned long flags; struct cmd_rcvr *rcvr; - struct list_head *entry1, *entry2; struct cmd_rcvr *rcvrs = NULL; user->valid = 1; @@ -812,8 +811,7 @@ int ipmi_destroy_user(ipmi_user_t user) * synchronize_rcu()) then free everything in that list. */ down(&intf->cmd_rcvrs_lock); - list_for_each_safe_rcu(entry1, entry2, &intf->cmd_rcvrs) { - rcvr = list_entry(entry1, struct cmd_rcvr, link); + list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) { if (rcvr->user == user) { list_del_rcu(&rcvr->link); rcvr->next = rcvrs; -- cgit From 76832c28de4fabbf32fe1e5a25194724a3430070 Mon Sep 17 00:00:00 2001 From: Dimitri Sivanich Date: Fri, 6 Jan 2006 11:33:41 -0600 Subject: [PATCH] shrink mmtimer memory size This greatly reduces the amount of memory used by mmtimer on smaller machines with large values of MAX_COMPACT_NODES. Signed-off-by: Dimitri Sivanich Signed-off-by: Christoph Lameter Signed-off-by: Linus Torvalds --- drivers/char/mmtimer.c | 90 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 33 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index 78c89a3e782..c92378121b4 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c @@ -1,11 +1,11 @@ /* - * Intel Multimedia Timer device implementation for SGI SN platforms. + * Timer device implementation for SGI SN platforms. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. + * Copyright (c) 2001-2006 Silicon Graphics, Inc. All rights reserved. * * This driver exports an API that should be supportable by any HPET or IA-PC * multimedia timer. The code below is currently specific to the SGI Altix @@ -45,7 +45,7 @@ MODULE_LICENSE("GPL"); /* name of the device, usually in /dev */ #define MMTIMER_NAME "mmtimer" #define MMTIMER_DESC "SGI Altix RTC Timer" -#define MMTIMER_VERSION "2.0" +#define MMTIMER_VERSION "2.1" #define RTC_BITS 55 /* 55 bits for this implementation */ @@ -227,10 +227,7 @@ typedef struct mmtimer { struct tasklet_struct tasklet; } mmtimer_t; -/* - * Total number of comparators is comparators/node * MAX nodes/running kernel - */ -static mmtimer_t timers[NUM_COMPARATORS*MAX_COMPACT_NODES]; +static mmtimer_t ** timers; /** * mmtimer_ioctl - ioctl interface for /dev/mmtimer @@ -441,29 +438,29 @@ static irqreturn_t mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { int i; - mmtimer_t *base = timers + cpu_to_node(smp_processor_id()) * - NUM_COMPARATORS; unsigned long expires = 0; int result = IRQ_NONE; + unsigned indx = cpu_to_node(smp_processor_id()); /* * Do this once for each comparison register */ for (i = 0; i < NUM_COMPARATORS; i++) { + mmtimer_t *base = timers[indx] + i; /* Make sure this doesn't get reused before tasklet_sched */ - spin_lock(&base[i].lock); - if (base[i].cpu == smp_processor_id()) { - if (base[i].timer) - expires = base[i].timer->it.mmtimer.expires; + spin_lock(&base->lock); + if (base->cpu == smp_processor_id()) { + if (base->timer) + expires = base->timer->it.mmtimer.expires; /* expires test won't work with shared irqs */ if ((mmtimer_int_pending(i) > 0) || (expires && (expires < rtc_time()))) { mmtimer_clr_int_pending(i); - tasklet_schedule(&base[i].tasklet); + tasklet_schedule(&base->tasklet); result = IRQ_HANDLED; } } - spin_unlock(&base[i].lock); + spin_unlock(&base->lock); expires = 0; } return result; @@ -523,7 +520,7 @@ static int sgi_timer_del(struct k_itimer *timr) { int i = timr->it.mmtimer.clock; cnodeid_t nodeid = timr->it.mmtimer.node; - mmtimer_t *t = timers + nodeid * NUM_COMPARATORS +i; + mmtimer_t *t = timers[nodeid] + i; unsigned long irqflags; if (i != TIMER_OFF) { @@ -609,11 +606,11 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, preempt_disable(); nodeid = cpu_to_node(smp_processor_id()); - base = timers + nodeid * NUM_COMPARATORS; retry: /* Don't use an allocated timer, or a deleted one that's pending */ for(i = 0; i< NUM_COMPARATORS; i++) { - if (!base[i].timer && !base[i].tasklet.state) { + base = timers[nodeid] + i; + if (!base->timer && !base->tasklet.state) { break; } } @@ -623,14 +620,14 @@ retry: return -EBUSY; } - spin_lock_irqsave(&base[i].lock, irqflags); + spin_lock_irqsave(&base->lock, irqflags); - if (base[i].timer || base[i].tasklet.state != 0) { - spin_unlock_irqrestore(&base[i].lock, irqflags); + if (base->timer || base->tasklet.state != 0) { + spin_unlock_irqrestore(&base->lock, irqflags); goto retry; } - base[i].timer = timr; - base[i].cpu = smp_processor_id(); + base->timer = timr; + base->cpu = smp_processor_id(); timr->it.mmtimer.clock = i; timr->it.mmtimer.node = nodeid; @@ -645,11 +642,11 @@ retry: } } else { timr->it.mmtimer.expires -= period; - if (reschedule_periodic_timer(base+i)) + if (reschedule_periodic_timer(base)) err = -EINVAL; } - spin_unlock_irqrestore(&base[i].lock, irqflags); + spin_unlock_irqrestore(&base->lock, irqflags); preempt_enable(); @@ -675,6 +672,7 @@ static struct k_clock sgi_clock = { static int __init mmtimer_init(void) { unsigned i; + cnodeid_t node, maxn = -1; if (!ia64_platform_is("sn2")) return -1; @@ -691,14 +689,6 @@ static int __init mmtimer_init(void) mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / 2) / sn_rtc_cycles_per_second; - for (i=0; i< NUM_COMPARATORS*MAX_COMPACT_NODES; i++) { - spin_lock_init(&timers[i].lock); - timers[i].timer = NULL; - timers[i].cpu = 0; - timers[i].i = i % NUM_COMPARATORS; - tasklet_init(&timers[i].tasklet, mmtimer_tasklet, (unsigned long) (timers+i)); - } - if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) { printk(KERN_WARNING "%s: unable to allocate interrupt.", MMTIMER_NAME); @@ -712,6 +702,40 @@ static int __init mmtimer_init(void) return -1; } + /* Get max numbered node, calculate slots needed */ + for_each_online_node(node) { + maxn = node; + } + maxn++; + + /* Allocate list of node ptrs to mmtimer_t's */ + timers = kmalloc(sizeof(mmtimer_t *)*maxn, GFP_KERNEL); + if (timers == NULL) { + printk(KERN_ERR "%s: failed to allocate memory for device\n", + MMTIMER_NAME); + return -1; + } + + /* Allocate mmtimer_t's for each online node */ + for_each_online_node(node) { + timers[node] = kmalloc_node(sizeof(mmtimer_t)*NUM_COMPARATORS, GFP_KERNEL, node); + if (timers[node] == NULL) { + printk(KERN_ERR "%s: failed to allocate memory for device\n", + MMTIMER_NAME); + return -1; + } + for (i=0; i< NUM_COMPARATORS; i++) { + mmtimer_t * base = timers[node] + i; + + spin_lock_init(&base->lock); + base->timer = NULL; + base->cpu = 0; + base->i = i; + tasklet_init(&base->tasklet, mmtimer_tasklet, + (unsigned long) (base)); + } + } + sgi_clock_period = sgi_clock.res = NSEC_PER_SEC / sn_rtc_cycles_per_second; register_posix_clock(CLOCK_SGI_CYCLE, &sgi_clock); -- cgit