* [PATCH] ahci: Convert timers to use timer_setup()
@ 2017-10-05 0:54 Kees Cook
2017-10-05 14:21 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2017-10-05 0:54 UTC (permalink / raw)
To: linux-kernel; +Cc: Tejun Heo, linux-ide, Thomas Gleixner
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. Adds a pointer back to link
structure.
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
drivers/ata/ahci.h | 1 +
drivers/ata/libahci.c | 11 ++++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 8b61123d2c3c..749fd94441b0 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -303,6 +303,7 @@ struct ahci_em_priv {
unsigned long saved_activity;
unsigned long activity;
unsigned long led_state;
+ struct ata_link *link;
};
struct ahci_port_priv {
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 3e286d86ab42..a0de7a38430c 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -968,12 +968,12 @@ static void ahci_sw_activity(struct ata_link *link)
mod_timer(&emp->timer, jiffies + msecs_to_jiffies(10));
}
-static void ahci_sw_activity_blink(unsigned long arg)
+static void ahci_sw_activity_blink(struct timer_list *t)
{
- struct ata_link *link = (struct ata_link *)arg;
+ struct ahci_em_priv *emp = from_timer(emp, t, timer);
+ struct ata_link *link = emp->link;
struct ata_port *ap = link->ap;
- struct ahci_port_priv *pp = ap->private_data;
- struct ahci_em_priv *emp = &pp->em_priv[link->pmp];
+
unsigned long led_message = emp->led_state;
u32 activity_led_state;
unsigned long flags;
@@ -1020,7 +1020,8 @@ static void ahci_init_sw_activity(struct ata_link *link)
/* init activity stats, setup timer */
emp->saved_activity = emp->activity = 0;
- setup_timer(&emp->timer, ahci_sw_activity_blink, (unsigned long)link);
+ emp->link = link;
+ timer_setup(&emp->timer, ahci_sw_activity_blink, 0);
/* check our blink policy and set flag for link if it's enabled */
if (emp->blink_policy)
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ahci: Convert timers to use timer_setup()
2017-10-05 0:54 [PATCH] ahci: Convert timers to use timer_setup() Kees Cook
@ 2017-10-05 14:21 ` Tejun Heo
2017-10-05 23:37 ` Kees Cook
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2017-10-05 14:21 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-kernel, linux-ide, Thomas Gleixner
On Wed, Oct 04, 2017 at 05:54:17PM -0700, Kees Cook wrote:
> 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. Adds a pointer back to link
> structure.
>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: linux-ide@vger.kernel.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Tejun Heo <tj@kernel.org>
Please feel free to route together with other timer patches.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ahci: Convert timers to use timer_setup()
2017-10-05 14:21 ` Tejun Heo
@ 2017-10-05 23:37 ` Kees Cook
2017-10-06 13:29 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2017-10-05 23:37 UTC (permalink / raw)
To: Tejun Heo; +Cc: LKML, linux-ide, Thomas Gleixner
On Thu, Oct 5, 2017 at 7:21 AM, Tejun Heo <tj@kernel.org> wrote:
> On Wed, Oct 04, 2017 at 05:54:17PM -0700, Kees Cook wrote:
>> 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. Adds a pointer back to link
>> structure.
>>
>> Cc: Tejun Heo <tj@kernel.org>
>> Cc: linux-ide@vger.kernel.org
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>
> Acked-by: Tejun Heo <tj@kernel.org>
>
> Please feel free to route together with other timer patches.
Most of the timer conversions are going via the maintainer trees. Are
you able to take these? If not, I can ask tglx to take them.
Thanks!
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ahci: Convert timers to use timer_setup()
2017-10-05 23:37 ` Kees Cook
@ 2017-10-06 13:29 ` Tejun Heo
0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2017-10-06 13:29 UTC (permalink / raw)
To: Kees Cook; +Cc: LKML, linux-ide, Thomas Gleixner
On Thu, Oct 05, 2017 at 04:37:43PM -0700, Kees Cook wrote:
> On Thu, Oct 5, 2017 at 7:21 AM, Tejun Heo <tj@kernel.org> wrote:
> > On Wed, Oct 04, 2017 at 05:54:17PM -0700, Kees Cook wrote:
> >> 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. Adds a pointer back to link
> >> structure.
> >>
> >> Cc: Tejun Heo <tj@kernel.org>
> >> Cc: linux-ide@vger.kernel.org
> >> Cc: Thomas Gleixner <tglx@linutronix.de>
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> >
> > Acked-by: Tejun Heo <tj@kernel.org>
> >
> > Please feel free to route together with other timer patches.
>
> Most of the timer conversions are going via the maintainer trees. Are
> you able to take these? If not, I can ask tglx to take them.
Yeah, please route through timer.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ahci: Convert timers to use timer_setup()
@ 2017-10-16 21:56 Kees Cook
0 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2017-10-16 21:56 UTC (permalink / raw)
To: linux-kernel; +Cc: Tejun Heo, linux-ide
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. Adds a pointer back to link
structure.
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Tejun Heo <tj@kernel.org>
---
Tejun asked that this go via the timer tree...
---
drivers/ata/ahci.h | 1 +
drivers/ata/libahci.c | 11 ++++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 8b61123d2c3c..749fd94441b0 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -303,6 +303,7 @@ struct ahci_em_priv {
unsigned long saved_activity;
unsigned long activity;
unsigned long led_state;
+ struct ata_link *link;
};
struct ahci_port_priv {
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 3e286d86ab42..a0de7a38430c 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -968,12 +968,12 @@ static void ahci_sw_activity(struct ata_link *link)
mod_timer(&emp->timer, jiffies + msecs_to_jiffies(10));
}
-static void ahci_sw_activity_blink(unsigned long arg)
+static void ahci_sw_activity_blink(struct timer_list *t)
{
- struct ata_link *link = (struct ata_link *)arg;
+ struct ahci_em_priv *emp = from_timer(emp, t, timer);
+ struct ata_link *link = emp->link;
struct ata_port *ap = link->ap;
- struct ahci_port_priv *pp = ap->private_data;
- struct ahci_em_priv *emp = &pp->em_priv[link->pmp];
+
unsigned long led_message = emp->led_state;
u32 activity_led_state;
unsigned long flags;
@@ -1020,7 +1020,8 @@ static void ahci_init_sw_activity(struct ata_link *link)
/* init activity stats, setup timer */
emp->saved_activity = emp->activity = 0;
- setup_timer(&emp->timer, ahci_sw_activity_blink, (unsigned long)link);
+ emp->link = link;
+ timer_setup(&emp->timer, ahci_sw_activity_blink, 0);
/* check our blink policy and set flag for link if it's enabled */
if (emp->blink_policy)
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-16 21:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 0:54 [PATCH] ahci: Convert timers to use timer_setup() Kees Cook
2017-10-05 14:21 ` Tejun Heo
2017-10-05 23:37 ` Kees Cook
2017-10-06 13:29 ` Tejun Heo
2017-10-16 21:56 Kees Cook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.