linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: android: ion: Use DEFINE_DEBUGFS_ATTRIBUTE
@ 2017-06-25 12:22 Tommy Nguyen
  2017-06-25 12:56 ` Greg Kroah-Hartman
  2017-06-27 17:44 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Tommy Nguyen @ 2017-06-25 12:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arve Hjønnevåg, Riley Andrews, linux-kernel, Tommy Nguyen

Running coccicheck indicates that DEFINE_DEBUGFS_ATTRIBUTE
and debugfs_create_file_unsafe should be used instead.

Signed-off-by: Tommy Nguyen <remyabel@gmail.com>
---
 drivers/staging/android/ion/ion.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 03d3a4f..8f96b38 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -544,8 +544,8 @@ static int debug_shrink_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
-			debug_shrink_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
+			 debug_shrink_set, "%llu\n");
 
 void ion_device_add_heap(struct ion_heap *heap)
 {
@@ -579,7 +579,7 @@ void ion_device_add_heap(struct ion_heap *heap)
 		char debug_name[64];
 
 		snprintf(debug_name, 64, "%s_shrink", heap->name);
-		debug_file = debugfs_create_file(
+		debug_file = debugfs_create_file_unsafe(
 			debug_name, 0644, dev->debug_root, heap,
 			&debug_shrink_fops);
 		if (!debug_file) {
-- 
2.9.4

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

* Re: [PATCH] staging: android: ion: Use DEFINE_DEBUGFS_ATTRIBUTE
  2017-06-25 12:22 [PATCH] staging: android: ion: Use DEFINE_DEBUGFS_ATTRIBUTE Tommy Nguyen
@ 2017-06-25 12:56 ` Greg Kroah-Hartman
  2017-06-27 17:44 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-25 12:56 UTC (permalink / raw)
  To: Tommy Nguyen; +Cc: Arve Hjønnevåg, Riley Andrews, linux-kernel

On Sun, Jun 25, 2017 at 08:22:06AM -0400, Tommy Nguyen wrote:
> Running coccicheck indicates that DEFINE_DEBUGFS_ATTRIBUTE
> and debugfs_create_file_unsafe should be used instead.

Why use the _unsafe version?  Are you sure it will work properly?  What
benifit does it offer?

> 
> Signed-off-by: Tommy Nguyen <remyabel@gmail.com>
> ---
>  drivers/staging/android/ion/ion.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 03d3a4f..8f96b38 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -544,8 +544,8 @@ static int debug_shrink_get(void *data, u64 *val)
>  	return 0;
>  }
>  
> -DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
> -			debug_shrink_set, "%llu\n");
> +DEFINE_DEBUGFS_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
> +			 debug_shrink_set, "%llu\n");

Are you sure this works?

thanks,

greg k-h

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

* Re: [PATCH] staging: android: ion: Use DEFINE_DEBUGFS_ATTRIBUTE
  2017-06-25 12:22 [PATCH] staging: android: ion: Use DEFINE_DEBUGFS_ATTRIBUTE Tommy Nguyen
  2017-06-25 12:56 ` Greg Kroah-Hartman
@ 2017-06-27 17:44 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-06-27 17:44 UTC (permalink / raw)
  To: Tommy Nguyen
  Cc: kbuild-all, Greg Kroah-Hartman, Arve Hjønnevåg,
	Riley Andrews, linux-kernel, Tommy Nguyen

[-- Attachment #1: Type: text/plain, Size: 1760 bytes --]

Hi Tommy,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.12-rc7 next-20170627]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Tommy-Nguyen/staging-android-ion-Use-DEFINE_DEBUGFS_ATTRIBUTE/20170626-055654
config: x86_64-randconfig-s3-06280039 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/staging/android/ion/ion.c: In function 'ion_device_add_heap':
>> drivers/staging/android/ion/ion.c:572:16: error: implicit declaration of function 'debugfs_create_file_unsafe' [-Werror=implicit-function-declaration]
      debug_file = debugfs_create_file_unsafe(
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/android/ion/ion.c:572:14: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      debug_file = debugfs_create_file_unsafe(
                 ^
   cc1: some warnings being treated as errors

vim +/debugfs_create_file_unsafe +572 drivers/staging/android/ion/ion.c

   566		plist_add(&heap->node, &dev->heaps);
   567	
   568		if (heap->shrinker.count_objects && heap->shrinker.scan_objects) {
   569			char debug_name[64];
   570	
   571			snprintf(debug_name, 64, "%s_shrink", heap->name);
 > 572			debug_file = debugfs_create_file_unsafe(
   573				debug_name, 0644, dev->debug_root, heap,
   574				&debug_shrink_fops);
   575			if (!debug_file) {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28062 bytes --]

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

end of thread, other threads:[~2017-06-27 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-25 12:22 [PATCH] staging: android: ion: Use DEFINE_DEBUGFS_ATTRIBUTE Tommy Nguyen
2017-06-25 12:56 ` Greg Kroah-Hartman
2017-06-27 17:44 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).