Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/pcmcia: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: David Howells <dhowells@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-pcmcia@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kees Cook and committed by
Greg Kroah-Hartman
32946cc2 4e826adc

+24 -31
+3 -3
drivers/pcmcia/bcm63xx_pcmcia.c
··· 263 263 /* 264 264 * socket polling timer callback 265 265 */ 266 - static void bcm63xx_pcmcia_poll(unsigned long data) 266 + static void bcm63xx_pcmcia_poll(struct timer_list *t) 267 267 { 268 268 struct bcm63xx_pcmcia_socket *skt; 269 269 unsigned int stat, events; 270 270 271 - skt = (struct bcm63xx_pcmcia_socket *)data; 271 + skt = from_timer(skt, t, timer); 272 272 273 273 spin_lock_bh(&skt->lock); 274 274 ··· 392 392 sock->map_size = resource_size(skt->common_res); 393 393 394 394 /* initialize polling timer */ 395 - setup_timer(&skt->timer, bcm63xx_pcmcia_poll, (unsigned long)skt); 395 + timer_setup(&skt->timer, bcm63xx_pcmcia_poll, 0); 396 396 397 397 /* initialize pcmcia control register, drive VS[12] to 0, 398 398 * leave CB IDSEL to the old value since it is set by the PCI
+3 -3
drivers/pcmcia/bfin_cf_pcmcia.c
··· 86 86 } 87 87 88 88 /* the timer is primarily to kick this socket's pccardd */ 89 - static void bfin_cf_timer(unsigned long _cf) 89 + static void bfin_cf_timer(struct timer_list *t) 90 90 { 91 - struct bfin_cf_socket *cf = (void *)_cf; 91 + struct bfin_cf_socket *cf = from_timer(cf, t, timer); 92 92 unsigned short present = bfin_cf_present(cf->cd_pfx); 93 93 94 94 if (present != cf->present) { ··· 227 227 228 228 cf->cd_pfx = cd_pfx; 229 229 230 - setup_timer(&cf->timer, bfin_cf_timer, (unsigned long)cf); 230 + timer_setup(&cf->timer, bfin_cf_timer, 0); 231 231 232 232 cf->pdev = pdev; 233 233 platform_set_drvdata(pdev, cf);
+2 -4
drivers/pcmcia/i82365.c
··· 875 875 return IRQ_RETVAL(handled); 876 876 } /* pcic_interrupt */ 877 877 878 - static void pcic_interrupt_wrapper(u_long data) 878 + static void pcic_interrupt_wrapper(struct timer_list *unused) 879 879 { 880 880 pcic_interrupt(0, NULL); 881 881 poll_timer.expires = jiffies + poll_interval; ··· 1289 1289 1290 1290 /* Finally, schedule a polling interrupt */ 1291 1291 if (poll_interval != 0) { 1292 - poll_timer.function = pcic_interrupt_wrapper; 1293 - poll_timer.data = 0; 1294 - init_timer(&poll_timer); 1292 + timer_setup(&poll_timer, pcic_interrupt_wrapper, 0); 1295 1293 poll_timer.expires = jiffies + poll_interval; 1296 1294 add_timer(&poll_timer); 1297 1295 }
+4 -4
drivers/pcmcia/omap_cf.c
··· 80 80 } 81 81 82 82 /* the timer is primarily to kick this socket's pccardd */ 83 - static void omap_cf_timer(unsigned long _cf) 83 + static void omap_cf_timer(struct timer_list *t) 84 84 { 85 - struct omap_cf_socket *cf = (void *) _cf; 85 + struct omap_cf_socket *cf = from_timer(cf, t, timer); 86 86 unsigned present = omap_cf_present(); 87 87 88 88 if (present != cf->present) { ··· 102 102 */ 103 103 static irqreturn_t omap_cf_irq(int irq, void *_cf) 104 104 { 105 - omap_cf_timer((unsigned long)_cf); 105 + omap_cf_timer(&_cf->timer); 106 106 return IRQ_HANDLED; 107 107 } 108 108 ··· 220 220 cf = kzalloc(sizeof *cf, GFP_KERNEL); 221 221 if (!cf) 222 222 return -ENOMEM; 223 - setup_timer(&cf->timer, omap_cf_timer, (unsigned long)cf); 223 + timer_setup(&cf->timer, omap_cf_timer, 0); 224 224 225 225 cf->pdev = pdev; 226 226 platform_set_drvdata(pdev, cf);
+3 -4
drivers/pcmcia/pd6729.c
··· 234 234 235 235 /* socket functions */ 236 236 237 - static void pd6729_interrupt_wrapper(unsigned long data) 237 + static void pd6729_interrupt_wrapper(struct timer_list *t) 238 238 { 239 - struct pd6729_socket *socket = (struct pd6729_socket *) data; 239 + struct pd6729_socket *socket = from_timer(socket, t, poll_timer); 240 240 241 241 pd6729_interrupt(0, (void *)socket); 242 242 mod_timer(&socket->poll_timer, jiffies + HZ); ··· 707 707 } 708 708 } else { 709 709 /* poll Card status change */ 710 - setup_timer(&socket->poll_timer, pd6729_interrupt_wrapper, 711 - (unsigned long)socket); 710 + timer_setup(&socket->poll_timer, pd6729_interrupt_wrapper, 0); 712 711 mod_timer(&socket->poll_timer, jiffies + HZ); 713 712 } 714 713
+3 -4
drivers/pcmcia/soc_common.c
··· 456 456 } 457 457 458 458 /* Let's poll for events in addition to IRQs since IRQ only is unreliable... */ 459 - static void soc_common_pcmcia_poll_event(unsigned long dummy) 459 + static void soc_common_pcmcia_poll_event(struct timer_list *t) 460 460 { 461 - struct soc_pcmcia_socket *skt = (struct soc_pcmcia_socket *)dummy; 461 + struct soc_pcmcia_socket *skt = from_timer(skt, t, poll_timer); 462 462 debug(skt, 4, "polling for events\n"); 463 463 464 464 mod_timer(&skt->poll_timer, jiffies + SOC_PCMCIA_POLL_PERIOD); ··· 794 794 795 795 skt->cs_state = dead_socket; 796 796 797 - setup_timer(&skt->poll_timer, soc_common_pcmcia_poll_event, 798 - (unsigned long)skt); 797 + timer_setup(&skt->poll_timer, soc_common_pcmcia_poll_event, 0); 799 798 skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD; 800 799 801 800 ret = request_resource(&iomem_resource, &skt->res_skt);
+3 -5
drivers/pcmcia/tcic.c
··· 98 98 /*====================================================================*/ 99 99 100 100 static irqreturn_t tcic_interrupt(int irq, void *dev); 101 - static void tcic_timer(u_long data); 101 + static void tcic_timer(struct timer_list *unused); 102 102 static struct pccard_operations tcic_operations; 103 103 104 104 struct tcic_socket { ··· 435 435 } 436 436 437 437 /* Set up polling */ 438 - poll_timer.function = &tcic_timer; 439 - poll_timer.data = 0; 440 - init_timer(&poll_timer); 438 + timer_setup(&poll_timer, &tcic_timer, 0); 441 439 442 440 /* Build interrupt mask */ 443 441 printk(KERN_CONT ", %d sockets\n", sockets); ··· 581 583 return IRQ_HANDLED; 582 584 } /* tcic_interrupt */ 583 585 584 - static void tcic_timer(u_long data) 586 + static void tcic_timer(struct timer_list *unused) 585 587 { 586 588 pr_debug("tcic_timer()\n"); 587 589 tcic_timer_pending = 0;
+3 -4
drivers/pcmcia/yenta_socket.c
··· 534 534 return IRQ_HANDLED; 535 535 } 536 536 537 - static void yenta_interrupt_wrapper(unsigned long data) 537 + static void yenta_interrupt_wrapper(struct timer_list *t) 538 538 { 539 - struct yenta_socket *socket = (struct yenta_socket *) data; 539 + struct yenta_socket *socket = from_timer(socket, t, poll_timer); 540 540 541 541 yenta_interrupt(0, (void *)socket); 542 542 socket->poll_timer.expires = jiffies + HZ; ··· 1233 1233 if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, IRQF_SHARED, "yenta", socket)) { 1234 1234 /* No IRQ or request_irq failed. Poll */ 1235 1235 socket->cb_irq = 0; /* But zero is a valid IRQ number. */ 1236 - setup_timer(&socket->poll_timer, yenta_interrupt_wrapper, 1237 - (unsigned long)socket); 1236 + timer_setup(&socket->poll_timer, yenta_interrupt_wrapper, 0); 1238 1237 mod_timer(&socket->poll_timer, jiffies + HZ); 1239 1238 dev_info(&dev->dev, 1240 1239 "no PCI IRQ, CardBus support disabled for this socket.\n");