All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cxl: fix coccinelle warnings
@ 2016-11-22 10:13 Andrew Donnellan
  2016-11-22 11:32 ` Frederic Barrat
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andrew Donnellan @ 2016-11-22 10:13 UTC (permalink / raw)
  To: linuxppc-dev, fbarrat, imunsie

Fix the following coccinelle warnings:

    drivers/misc/cxl/debugfs.c:46:0-23: WARNING: fops_io_x64 should be
        defined with DEFINE_DEBUGFS_ATTRIBUTE
    drivers/misc/cxl/guest.c:890:5-26: WARNING: Comparison to bool
    drivers/misc/cxl/irq.c:107:3-23: WARNING: Assignment of bool to 0/1
    drivers/misc/cxl/native.c:57:2-3: Unneeded semicolon
    drivers/misc/cxl/native.c:170:2-3: Unneeded semicolon

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
 drivers/misc/cxl/debugfs.c | 6 ++++--
 drivers/misc/cxl/guest.c   | 2 +-
 drivers/misc/cxl/irq.c     | 2 +-
 drivers/misc/cxl/native.c  | 4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/misc/cxl/debugfs.c b/drivers/misc/cxl/debugfs.c
index ec7b8a0..9c06ac8 100644
--- a/drivers/misc/cxl/debugfs.c
+++ b/drivers/misc/cxl/debugfs.c
@@ -43,12 +43,14 @@ static int debugfs_io_u64_set(void *data, u64 val)
 	out_be64((u64 __iomem *)data, val);
 	return 0;
 }
-DEFINE_SIMPLE_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set, "0x%016llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set,
+			 "0x%016llx\n");
 
 static struct dentry *debugfs_create_io_x64(const char *name, umode_t mode,
 					    struct dentry *parent, u64 __iomem *value)
 {
-	return debugfs_create_file(name, mode, parent, (void __force *)value, &fops_io_x64);
+	return debugfs_create_file_unsafe(name, mode, parent,
+					  (void __force *)value, &fops_io_x64);
 }
 
 void cxl_debugfs_add_adapter_psl_regs(struct cxl *adapter, struct dentry *dir)
diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
index 3e102cd..e04bc4d 100644
--- a/drivers/misc/cxl/guest.c
+++ b/drivers/misc/cxl/guest.c
@@ -887,7 +887,7 @@ static void afu_handle_errstate(struct work_struct *work)
 	    afu_guest->previous_state == H_STATE_PERM_UNAVAILABLE)
 		return;
 
-	if (afu_guest->handle_err == true)
+	if (afu_guest->handle_err)
 		schedule_delayed_work(&afu_guest->work_err,
 				      msecs_to_jiffies(3000));
 }
diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index dec60f5..1a402bb 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -104,7 +104,7 @@ irqreturn_t cxl_irq(int irq, struct cxl_context *ctx, struct cxl_irq_info *irq_i
 		} else {
 			spin_lock(&ctx->lock);
 			ctx->afu_err = irq_info->afu_err;
-			ctx->pending_afu_err = 1;
+			ctx->pending_afu_err = true;
 			spin_unlock(&ctx->lock);
 
 			wake_up_all(&ctx->wq);
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c
index a217a74..fe56d1b 100644
--- a/drivers/misc/cxl/native.c
+++ b/drivers/misc/cxl/native.c
@@ -54,7 +54,7 @@ static int afu_control(struct cxl_afu *afu, u64 command, u64 clear,
 				     AFU_Cntl | command);
 		cpu_relax();
 		AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
-	};
+	}
 
 	if (AFU_Cntl & CXL_AFU_Cntl_An_RA) {
 		/*
@@ -167,7 +167,7 @@ int cxl_psl_purge(struct cxl_afu *afu)
 			cpu_relax();
 		}
 		PSL_CNTL = cxl_p1n_read(afu, CXL_PSL_SCNTL_An);
-	};
+	}
 	end = local_clock();
 	pr_devel("PSL purged in %lld ns\n", end - start);
 
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] cxl: fix coccinelle warnings
  2016-11-22 10:13 [PATCH] cxl: fix coccinelle warnings Andrew Donnellan
@ 2016-11-22 11:32 ` Frederic Barrat
  2016-11-22 17:03 ` Matthew R. Ochs
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Frederic Barrat @ 2016-11-22 11:32 UTC (permalink / raw)
  To: Andrew Donnellan, linuxppc-dev, imunsie



Le 22/11/2016 à 11:13, Andrew Donnellan a écrit :
> Fix the following coccinelle warnings:
>
>     drivers/misc/cxl/debugfs.c:46:0-23: WARNING: fops_io_x64 should be
>         defined with DEFINE_DEBUGFS_ATTRIBUTE
>     drivers/misc/cxl/guest.c:890:5-26: WARNING: Comparison to bool
>     drivers/misc/cxl/irq.c:107:3-23: WARNING: Assignment of bool to 0/1
>     drivers/misc/cxl/native.c:57:2-3: Unneeded semicolon
>     drivers/misc/cxl/native.c:170:2-3: Unneeded semicolon
>
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---

Thanks!

Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cxl: fix coccinelle warnings
  2016-11-22 10:13 [PATCH] cxl: fix coccinelle warnings Andrew Donnellan
  2016-11-22 11:32 ` Frederic Barrat
@ 2016-11-22 17:03 ` Matthew R. Ochs
  2016-11-23  6:49 ` Ian Munsie
  2016-11-25  0:04 ` Michael Ellerman
  3 siblings, 0 replies; 7+ messages in thread
From: Matthew R. Ochs @ 2016-11-22 17:03 UTC (permalink / raw)
  To: Andrew Donnellan; +Cc: linuxppc-dev, fbarrat, imunsie

> On Nov 22, 2016, at 4:13 AM, Andrew Donnellan =
<andrew.donnellan@au1.ibm.com> wrote:
>=20
> Fix the following coccinelle warnings:
>=20
>    drivers/misc/cxl/debugfs.c:46:0-23: WARNING: fops_io_x64 should be
>        defined with DEFINE_DEBUGFS_ATTRIBUTE
>    drivers/misc/cxl/guest.c:890:5-26: WARNING: Comparison to bool
>    drivers/misc/cxl/irq.c:107:3-23: WARNING: Assignment of bool to 0/1
>    drivers/misc/cxl/native.c:57:2-3: Unneeded semicolon
>    drivers/misc/cxl/native.c:170:2-3: Unneeded semicolon
>=20
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cxl: fix coccinelle warnings
  2016-11-22 10:13 [PATCH] cxl: fix coccinelle warnings Andrew Donnellan
  2016-11-22 11:32 ` Frederic Barrat
  2016-11-22 17:03 ` Matthew R. Ochs
@ 2016-11-23  6:49 ` Ian Munsie
  2016-11-23  7:06   ` Andrew Donnellan
  2016-11-25  0:04 ` Michael Ellerman
  3 siblings, 1 reply; 7+ messages in thread
From: Ian Munsie @ 2016-11-23  6:49 UTC (permalink / raw)
  To: andrew.donnellan; +Cc: linuxppc-dev, fbarrat

Most of these look fine

> -    return debugfs_create_file(name, mode, parent, (void __force *)value, &fops_io_x64);
> +    return debugfs_create_file_unsafe(name, mode, parent,
> +                      (void __force *)value, &fops_io_x64);

Just wondering what this one is about?

Cheers,
-Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cxl: fix coccinelle warnings
  2016-11-23  6:49 ` Ian Munsie
@ 2016-11-23  7:06   ` Andrew Donnellan
  2016-11-23  7:32     ` Ian Munsie
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Donnellan @ 2016-11-23  7:06 UTC (permalink / raw)
  To: Ian Munsie; +Cc: linuxppc-dev, fbarrat

On 23/11/16 17:49, Ian Munsie wrote:
> Most of these look fine
>
>> -    return debugfs_create_file(name, mode, parent, (void __force *)value, &fops_io_x64);
>> +    return debugfs_create_file_unsafe(name, mode, parent,
>> +                      (void __force *)value, &fops_io_x64);
>
> Just wondering what this one is about?

See explanation at https://lkml.org/lkml/2016/3/6/75 - when we use 
DEFINE_DEBUGFS_ATTRIBUTE() rather than DEFINE_SIMPLE_ATTRIBUTE(), we 
don't need the "lifetime managing proxy" that debugfs_create_file() sets up.

coccinelle proposed that change based on 
scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cxl: fix coccinelle warnings
  2016-11-23  7:06   ` Andrew Donnellan
@ 2016-11-23  7:32     ` Ian Munsie
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Munsie @ 2016-11-23  7:32 UTC (permalink / raw)
  To: andrew.donnellan; +Cc: linuxppc-dev, fbarrat

Excerpts from andrew.donnellan's message of 2016-11-23 18:06:59 +1100:
> On 23/11/16 17:49, Ian Munsie wrote:
> > Most of these look fine
> >
> >> -    return debugfs_create_file(name, mode, parent, (void __force *)value, &fops_io_x64);
> >> +    return debugfs_create_file_unsafe(name, mode, parent,
> >> +                      (void __force *)value, &fops_io_x64);
> >
> > Just wondering what this one is about?
> 
> See explanation at https://lkml.org/lkml/2016/3/6/75 - when we use 
> DEFINE_DEBUGFS_ATTRIBUTE() rather than DEFINE_SIMPLE_ATTRIBUTE(), we 
> don't need the "lifetime managing proxy" that debugfs_create_file() sets up.
> 
> coccinelle proposed that change based on 
> scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Thanks, that makes sense :)

Acked-by: Ian Munsie <imunsie@au1.ibm.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cxl: fix coccinelle warnings
  2016-11-22 10:13 [PATCH] cxl: fix coccinelle warnings Andrew Donnellan
                   ` (2 preceding siblings ...)
  2016-11-23  6:49 ` Ian Munsie
@ 2016-11-25  0:04 ` Michael Ellerman
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2016-11-25  0:04 UTC (permalink / raw)
  To: Andrew Donnellan, linuxppc-dev, fbarrat, imunsie

On Tue, 2016-11-22 at 10:13:27 UTC, Andrew Donnellan wrote:
> Fix the following coccinelle warnings:
> 
>     drivers/misc/cxl/debugfs.c:46:0-23: WARNING: fops_io_x64 should be
>         defined with DEFINE_DEBUGFS_ATTRIBUTE
>     drivers/misc/cxl/guest.c:890:5-26: WARNING: Comparison to bool
>     drivers/misc/cxl/irq.c:107:3-23: WARNING: Assignment of bool to 0/1
>     drivers/misc/cxl/native.c:57:2-3: Unneeded semicolon
>     drivers/misc/cxl/native.c:170:2-3: Unneeded semicolon
> 
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
> Acked-by: Ian Munsie <imunsie@au1.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/3382a6220ff3bac886d9d90766f3fe

cheers

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-25  0:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22 10:13 [PATCH] cxl: fix coccinelle warnings Andrew Donnellan
2016-11-22 11:32 ` Frederic Barrat
2016-11-22 17:03 ` Matthew R. Ochs
2016-11-23  6:49 ` Ian Munsie
2016-11-23  7:06   ` Andrew Donnellan
2016-11-23  7:32     ` Ian Munsie
2016-11-25  0:04 ` Michael Ellerman

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.