* [RESEND PATCH v2] mfd: twl6030: Fix endianness problem in IRQ handler
@ 2013-12-23 17:11 Taras Kondratiuk
2013-12-23 17:20 ` Joe Perches
2014-01-06 10:43 ` Lee Jones
0 siblings, 2 replies; 4+ messages in thread
From: Taras Kondratiuk @ 2013-12-23 17:11 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones
Cc: patches, linaro-networking, linaro-kernel, Danke Xie,
Taras Kondratiuk, linux-kernel
From: Danke Xie <d.xie@sta.samsung.com>
The current TWL 6030 IRQ handler assumes little endianness.
This change makes it endian-neutral.
Signed-off-by: Danke Xie <d.xie@sta.samsung.com>
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
v2: fixed sparse warning
v1: https://patchwork.kernel.org/patch/2974331/
drivers/mfd/twl6030-irq.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index 517eda8..18a607e 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -176,8 +176,9 @@ static irqreturn_t twl6030_irq_thread(int irq, void *data)
int i, ret;
union {
u8 bytes[4];
- u32 int_sts;
+ __le32 int_sts;
} sts;
+ u32 int_sts; /* sts.int_sts converted to CPU endianness */
struct twl6030_irq *pdata = data;
/* read INT_STS_A, B and C in one shot using a burst read */
@@ -196,8 +197,9 @@ static irqreturn_t twl6030_irq_thread(int irq, void *data)
if (sts.bytes[2] & 0x10)
sts.bytes[2] |= 0x08;
- for (i = 0; sts.int_sts; sts.int_sts >>= 1, i++)
- if (sts.int_sts & 0x1) {
+ int_sts = le32_to_cpu(sts.int_sts);
+ for (i = 0; int_sts; int_sts >>= 1, i++)
+ if (int_sts & 0x1) {
int module_irq =
irq_find_mapping(pdata->irq_domain,
pdata->irq_mapping_tbl[i]);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RESEND PATCH v2] mfd: twl6030: Fix endianness problem in IRQ handler
2013-12-23 17:11 [RESEND PATCH v2] mfd: twl6030: Fix endianness problem in IRQ handler Taras Kondratiuk
@ 2013-12-23 17:20 ` Joe Perches
2013-12-23 17:47 ` Taras Kondratiuk
2014-01-06 10:43 ` Lee Jones
1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2013-12-23 17:20 UTC (permalink / raw)
To: Taras Kondratiuk
Cc: Samuel Ortiz, Lee Jones, patches, linaro-networking,
linaro-kernel, Danke Xie, linux-kernel
On Mon, 2013-12-23 at 19:11 +0200, Taras Kondratiuk wrote:
> From: Danke Xie <d.xie@sta.samsung.com>
>
> The current TWL 6030 IRQ handler assumes little endianness.
> This change makes it endian-neutral.
[]
> diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
[]
> @@ -196,8 +197,9 @@ static irqreturn_t twl6030_irq_thread(int irq, void *data)
> if (sts.bytes[2] & 0x10)
> sts.bytes[2] |= 0x08;
>
> - for (i = 0; sts.int_sts; sts.int_sts >>= 1, i++)
> - if (sts.int_sts & 0x1) {
> + int_sts = le32_to_cpu(sts.int_sts);
> + for (i = 0; int_sts; int_sts >>= 1, i++)
> + if (int_sts & 0x1) {
> int module_irq =
> irq_find_mapping(pdata->irq_domain,
> pdata->irq_mapping_tbl[i]);
instead of the
for (...) {
if (foo & 1) {
maybe using ffs would be better/faster
while ((bit = ffs(int_sts))) {
etc...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND PATCH v2] mfd: twl6030: Fix endianness problem in IRQ handler
2013-12-23 17:20 ` Joe Perches
@ 2013-12-23 17:47 ` Taras Kondratiuk
0 siblings, 0 replies; 4+ messages in thread
From: Taras Kondratiuk @ 2013-12-23 17:47 UTC (permalink / raw)
To: Joe Perches
Cc: Samuel Ortiz, Lee Jones, Patch Tracking, Linaro Networking,
Linaro Kernel, Danke Xie, open list
On 23 December 2013 19:20, Joe Perches <joe@perches.com> wrote:
> On Mon, 2013-12-23 at 19:11 +0200, Taras Kondratiuk wrote:
>> From: Danke Xie <d.xie@sta.samsung.com>
>>
>> The current TWL 6030 IRQ handler assumes little endianness.
>> This change makes it endian-neutral.
> []
>> diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
> []
>> @@ -196,8 +197,9 @@ static irqreturn_t twl6030_irq_thread(int irq, void *data)
>> if (sts.bytes[2] & 0x10)
>> sts.bytes[2] |= 0x08;
>>
>> - for (i = 0; sts.int_sts; sts.int_sts >>= 1, i++)
>> - if (sts.int_sts & 0x1) {
>> + int_sts = le32_to_cpu(sts.int_sts);
>> + for (i = 0; int_sts; int_sts >>= 1, i++)
>> + if (int_sts & 0x1) {
>> int module_irq =
>> irq_find_mapping(pdata->irq_domain,
>> pdata->irq_mapping_tbl[i]);
>
> instead of the
>
> for (...) {
> if (foo & 1) {
>
>
> maybe using ffs would be better/faster
>
> while ((bit = ffs(int_sts))) {
>
> etc...
Makes sense, but the aim of this patch is to fix endianness issue.
This micro-optimisation can be done as a separate patch.
--
Regards,
Taras Kondratiuk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND PATCH v2] mfd: twl6030: Fix endianness problem in IRQ handler
2013-12-23 17:11 [RESEND PATCH v2] mfd: twl6030: Fix endianness problem in IRQ handler Taras Kondratiuk
2013-12-23 17:20 ` Joe Perches
@ 2014-01-06 10:43 ` Lee Jones
1 sibling, 0 replies; 4+ messages in thread
From: Lee Jones @ 2014-01-06 10:43 UTC (permalink / raw)
To: Taras Kondratiuk
Cc: Samuel Ortiz, patches, linaro-networking, linaro-kernel,
Danke Xie, linux-kernel
On Mon, 23 Dec 2013, Taras Kondratiuk wrote:
> From: Danke Xie <d.xie@sta.samsung.com>
>
> The current TWL 6030 IRQ handler assumes little endianness.
> This change makes it endian-neutral.
>
> Signed-off-by: Danke Xie <d.xie@sta.samsung.com>
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
> v2: fixed sparse warning
> v1: https://patchwork.kernel.org/patch/2974331/
>
> drivers/mfd/twl6030-irq.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
Applied, thanks.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-06 10:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-23 17:11 [RESEND PATCH v2] mfd: twl6030: Fix endianness problem in IRQ handler Taras Kondratiuk
2013-12-23 17:20 ` Joe Perches
2013-12-23 17:47 ` Taras Kondratiuk
2014-01-06 10:43 ` Lee Jones
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.