2017-03-24 14:15:43

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] aoe: use setup_timer

Use setup_timer() instead of init_timer() to simplify the code.

Signed-off-by: Geliang Tang <[email protected]>
---
drivers/block/aoe/aoemain.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
index 4b987c2..20865d4 100644
--- a/drivers/block/aoe/aoemain.c
+++ b/drivers/block/aoe/aoemain.c
@@ -28,10 +28,8 @@ discover_timer(ulong vp)

switch (vp) {
case TINIT:
- init_timer(&t);
+ setup_timer(&t, discover_timer, TRUN);
spin_lock_init(&lock);
- t.data = TRUN;
- t.function = discover_timer;
die = 0;
case TRUN:
spin_lock_irqsave(&lock, flags);
--
2.9.3


2017-03-24 14:15:52

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] block: floppy: use setup_timer

Use setup_timer() instead of init_timer() to simplify the code.

Signed-off-by: Geliang Tang <[email protected]>
---
drivers/block/floppy.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 45b4384..ce102ec 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4207,9 +4207,7 @@ static int __init do_floppy_init(void)
disks[drive]->fops = &floppy_fops;
sprintf(disks[drive]->disk_name, "fd%d", drive);

- init_timer(&motor_off_timer[drive]);
- motor_off_timer[drive].data = drive;
- motor_off_timer[drive].function = motor_off_callback;
+ setup_timer(&motor_off_timer[drive], motor_off_callback, drive);
}

err = register_blkdev(FLOPPY_MAJOR, "fd");
--
2.9.3

2017-03-24 14:16:38

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] ipmi_ssif: use setup_timer

Use setup_timer() instead of init_timer() to simplify the code.

Signed-off-by: Geliang Tang <[email protected]>
---
drivers/char/ipmi/ipmi_ssif.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index cca6e5b..a92a049 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1642,9 +1642,8 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)

spin_lock_init(&ssif_info->lock);
ssif_info->ssif_state = SSIF_NORMAL;
- init_timer(&ssif_info->retry_timer);
- ssif_info->retry_timer.data = (unsigned long) ssif_info;
- ssif_info->retry_timer.function = retry_timeout;
+ setup_timer(&ssif_info->retry_timer, retry_timeout,
+ (unsigned long)ssif_info);

for (i = 0; i < SSIF_NUM_STATS; i++)
atomic_set(&ssif_info->stats[i], 0);
--
2.9.3

2017-03-24 14:16:59

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] mg_disk: use setup_timer

Use setup_timer() instead of init_timer() to simplify the code.

Signed-off-by: Geliang Tang <[email protected]>
---
drivers/block/mg_disk.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 286f276..e88e7b0 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -989,9 +989,7 @@ static int mg_probe(struct platform_device *plat_dev)
blk_queue_max_hw_sectors(host->breq, MG_MAX_SECTS);
blk_queue_logical_block_size(host->breq, MG_SECTOR_SIZE);

- init_timer(&host->timer);
- host->timer.function = mg_times_out;
- host->timer.data = (unsigned long)host;
+ setup_timer(&host->timer, mg_times_out, (unsigned long)host);

host->gd = alloc_disk(MG_DISK_MAX_PART);
if (!host->gd) {
--
2.9.3

2017-03-24 14:17:26

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] x86/pci-calgary: use setup_timer

Use setup_timer() instead of init_timer() to simplify the code.

Signed-off-by: Geliang Tang <[email protected]>
---
arch/x86/kernel/pci-calgary_64.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 0c150c0..fda7867 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1007,9 +1007,8 @@ static void __init calgary_enable_translation(struct pci_dev *dev)
writel(cpu_to_be32(val32), target);
readl(target); /* flush */

- init_timer(&tbl->watchdog_timer);
- tbl->watchdog_timer.function = &calgary_watchdog;
- tbl->watchdog_timer.data = (unsigned long)dev;
+ setup_timer(&tbl->watchdog_timer, &calgary_watchdog,
+ (unsigned long)dev);
mod_timer(&tbl->watchdog_timer, jiffies);
}

--
2.9.3

2017-03-24 14:17:54

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] drbd: use setup_timer

Use setup_timer() instead of init_timer() to simplify the code.

Signed-off-by: Geliang Tang <[email protected]>
---
drivers/block/drbd/drbd_main.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 92c60cb..09846fc 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2011,18 +2011,14 @@ void drbd_init_set_defaults(struct drbd_device *device)
device->unplug_work.cb = w_send_write_hint;
device->bm_io_work.w.cb = w_bitmap_io;

- init_timer(&device->resync_timer);
- init_timer(&device->md_sync_timer);
- init_timer(&device->start_resync_timer);
- init_timer(&device->request_timer);
- device->resync_timer.function = resync_timer_fn;
- device->resync_timer.data = (unsigned long) device;
- device->md_sync_timer.function = md_sync_timer_fn;
- device->md_sync_timer.data = (unsigned long) device;
- device->start_resync_timer.function = start_resync_timer_fn;
- device->start_resync_timer.data = (unsigned long) device;
- device->request_timer.function = request_timer_fn;
- device->request_timer.data = (unsigned long) device;
+ setup_timer(&device->resync_timer, resync_timer_fn,
+ (unsigned long)device);
+ setup_timer(&device->md_sync_timer, md_sync_timer_fn,
+ (unsigned long)device);
+ setup_timer(&device->start_resync_timer, start_resync_timer_fn,
+ (unsigned long)device);
+ setup_timer(&device->request_timer, request_timer_fn,
+ (unsigned long)device);

init_waitqueue_head(&device->misc_wait);
init_waitqueue_head(&device->state_wait);
--
2.9.3

2017-03-24 14:24:48

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] block: floppy: use setup_timer

On 03/24/2017 08:15 AM, Geliang Tang wrote:
> Use setup_timer() instead of init_timer() to simplify the code.

Added this (and mg_disk) for 4.12. Please consider using a cover
letter sending more than one patch in the future.

--
Jens Axboe

2017-03-25 02:59:56

by Corey Minyard

[permalink] [raw]
Subject: Re: [PATCH] ipmi_ssif: use setup_timer

A little nicer, yes. In queue for the next release.

Thanks,

-corey

On 03/24/2017 09:15 AM, Geliang Tang wrote:
> Use setup_timer() instead of init_timer() to simplify the code.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> drivers/char/ipmi/ipmi_ssif.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index cca6e5b..a92a049 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1642,9 +1642,8 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
>
> spin_lock_init(&ssif_info->lock);
> ssif_info->ssif_state = SSIF_NORMAL;
> - init_timer(&ssif_info->retry_timer);
> - ssif_info->retry_timer.data = (unsigned long) ssif_info;
> - ssif_info->retry_timer.function = retry_timeout;
> + setup_timer(&ssif_info->retry_timer, retry_timeout,
> + (unsigned long)ssif_info);
>
> for (i = 0; i < SSIF_NUM_STATS; i++)
> atomic_set(&ssif_info->stats[i], 0);


2017-03-25 19:32:32

by Ed Cashin

[permalink] [raw]
Subject: Re: [PATCH] aoe: use setup_timer

On 03/24/2017 10:15 AM, Geliang Tang wrote:
> Use setup_timer() instead of init_timer() to simplify the code.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> drivers/block/aoe/aoemain.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
> index 4b987c2..20865d4 100644
> --- a/drivers/block/aoe/aoemain.c
> +++ b/drivers/block/aoe/aoemain.c
> @@ -28,10 +28,8 @@ discover_timer(ulong vp)
>
> switch (vp) {
> case TINIT:
> - init_timer(&t);
> + setup_timer(&t, discover_timer, TRUN);
> spin_lock_init(&lock);
> - t.data = TRUN;
> - t.function = discover_timer;
> die = 0;
> case TRUN:
> spin_lock_irqsave(&lock, flags);
>

This change looks OK to me, thanks.

--
Ed

Subject: [tip:x86/cleanups] x86/pci-calgary: Use setup_timer() instead of open coding it.

Commit-ID: 352ef03ca0ad07156bcee6e244c2df6f1a19bb05
Gitweb: http://git.kernel.org/tip/352ef03ca0ad07156bcee6e244c2df6f1a19bb05
Author: Geliang Tang <[email protected]>
AuthorDate: Fri, 24 Mar 2017 22:15:14 +0800
Committer: Thomas Gleixner <[email protected]>
CommitDate: Fri, 31 Mar 2017 10:21:04 +0200

x86/pci-calgary: Use setup_timer() instead of open coding it.

Use setup_timer() instead of init_timer() to simplify the code.

Signed-off-by: Geliang Tang <[email protected]>
Cc: [email protected]
Cc: Jon Mason <[email protected]>
Cc: Muli Ben-Yehuda <[email protected]>
Link: http://lkml.kernel.org/r/e4f1888b9e4a87f6a6345f86ed23071483763b22.1490340972.git.geliangtang@gmail.com
Signed-off-by: Thomas Gleixner <[email protected]>

---
arch/x86/kernel/pci-calgary_64.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 0c150c0..fda7867 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1007,9 +1007,8 @@ static void __init calgary_enable_translation(struct pci_dev *dev)
writel(cpu_to_be32(val32), target);
readl(target); /* flush */

- init_timer(&tbl->watchdog_timer);
- tbl->watchdog_timer.function = &calgary_watchdog;
- tbl->watchdog_timer.data = (unsigned long)dev;
+ setup_timer(&tbl->watchdog_timer, &calgary_watchdog,
+ (unsigned long)dev);
mod_timer(&tbl->watchdog_timer, jiffies);
}