diff mbox series

macintosh/via-pmu-led: make disk activity usage a parameter.

Message ID 20211025072508.8667-1-maahiuzeon@gmail.com (mailing list archive)
State Superseded, archived
Headers show
Series macintosh/via-pmu-led: make disk activity usage a parameter. | expand
Related show

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_sparse fail sparse (pmac32, ubuntu-21.04, ppc64) failed at step Build.
snowpatch_ozlabs/github-powerpc_kernel_qemu fail kernel (pmac32_defconfig, korg-5.5.0, /linux/arch/powerpc/configs/pmac32-qemu.config) failed at step build.
snowpatch_ozlabs/github-powerpc_clang fail kernel (pmac32, ubuntu-21.04, ppc64) failed at step build.

Commit Message

Hill Ma Oct. 25, 2021, 7:25 a.m. UTC
Whether to use the LED as a disk activity is a user preference.
Some like this usage while others find the LED too bright. So it
might be a good idea to make this choice a runtime parameter rather
than compile-time config.

The default is set to disabled as OS X does not use the LED as a
disk activity indicator.

Signed-off-by: Hill Ma <maahiuzeon@gmail.com>
---
 Documentation/admin-guide/kernel-parameters.txt |  6 ++++++
 drivers/macintosh/Kconfig                       | 10 ----------
 drivers/macintosh/via-pmu-led.c                 | 11 ++++++++---
 3 files changed, 14 insertions(+), 13 deletions(-)

Comments

kernel test robot Oct. 26, 2021, 12:35 a.m. UTC | #1
Hi Hill,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.15-rc7 next-20211025]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hill-Ma/macintosh-via-pmu-led-make-disk-activity-usage-a-parameter/20211025-152845
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 87066fdd2e30fe9dd531125d95257c118a74617e
config: powerpc-pmac32_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/9f9763c0836766055225087cee4126f8d2974252
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hill-Ma/macintosh-via-pmu-led-make-disk-activity-usage-a-parameter/20211025-152845
        git checkout 9f9763c0836766055225087cee4126f8d2974252
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from drivers/macintosh/via-pmu-led.c:28:
   drivers/macintosh/via-pmu-led.c: In function '__check_adb_pmu_led_disk':
>> include/linux/moduleparam.h:329:34: error: returning 'int *' from a function with incompatible return type 'bool *' {aka '_Bool *'} [-Werror=incompatible-pointer-types]
     329 |         param_check_##type(name, &(var));                               \
         |                                  ^
   include/linux/moduleparam.h:409:75: note: in definition of macro '__param_check'
     409 |         static inline type __always_unused *__check_##name(void) { return(p); }
         |                                                                           ^
   include/linux/moduleparam.h:329:9: note: in expansion of macro 'param_check_bool'
     329 |         param_check_##type(name, &(var));                               \
         |         ^~~~~~~~~~~~
   drivers/macintosh/via-pmu-led.c:120:1: note: in expansion of macro 'core_param'
     120 | core_param(adb_pmu_led_disk, adb_pmu_led_disk, bool, 0644);
         | ^~~~~~~~~~
   cc1: some warnings being treated as errors


vim +329 include/linux/moduleparam.h

907b29eb41aa604 Rusty Russell   2010-08-11  314  
67e67ceaac5bf55 Rusty Russell   2008-10-22  315  #ifndef MODULE
67e67ceaac5bf55 Rusty Russell   2008-10-22  316  /**
67e67ceaac5bf55 Rusty Russell   2008-10-22  317   * core_param - define a historical core kernel parameter.
67e67ceaac5bf55 Rusty Russell   2008-10-22  318   * @name: the name of the cmdline and sysfs parameter (often the same as var)
67e67ceaac5bf55 Rusty Russell   2008-10-22  319   * @var: the variable
546970bc6afc7fb Rusty Russell   2010-08-11  320   * @type: the type of the parameter
67e67ceaac5bf55 Rusty Russell   2008-10-22  321   * @perm: visibility in sysfs
67e67ceaac5bf55 Rusty Russell   2008-10-22  322   *
67e67ceaac5bf55 Rusty Russell   2008-10-22  323   * core_param is just like module_param(), but cannot be modular and
67e67ceaac5bf55 Rusty Russell   2008-10-22  324   * doesn't add a prefix (such as "printk.").  This is for compatibility
67e67ceaac5bf55 Rusty Russell   2008-10-22  325   * with __setup(), and it makes sense as truly core parameters aren't
67e67ceaac5bf55 Rusty Russell   2008-10-22  326   * tied to the particular file they're in.
67e67ceaac5bf55 Rusty Russell   2008-10-22  327   */
67e67ceaac5bf55 Rusty Russell   2008-10-22  328  #define core_param(name, var, type, perm)				\
67e67ceaac5bf55 Rusty Russell   2008-10-22 @329  	param_check_##type(name, &(var));				\
91f9d330cc14932 Jani Nikula     2014-08-27  330  	__module_param_call("", name, &param_ops_##type, &var, perm, -1, 0)
ec0ccc16a09fc32 Dmitry Torokhov 2015-03-30  331  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 43dc35fe5bc0..a656a51ba0a8 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -250,6 +250,12 @@ 
 			Use timer override. For some broken Nvidia NF5 boards
 			that require a timer override, but don't have HPET
 
+	adb_pmu_led_disk [PPC]
+			Use front LED as disk LED by default. Only applies to
+			PowerBook, iBook, PowerMac 7,2/7,3.
+			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
+			Default: disabled
+
 	add_efi_memmap	[EFI; X86] Include EFI memory map in
 			kernel's map of available physical RAM.
 
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 5cdc361da37c..243215de563c 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -78,16 +78,6 @@  config ADB_PMU_LED
 	  behaviour of the old CONFIG_BLK_DEV_IDE_PMAC_BLINK, select this
 	  and the disk LED trigger and configure appropriately through sysfs.
 
-config ADB_PMU_LED_DISK
-	bool "Use front LED as DISK LED by default"
-	depends on ADB_PMU_LED
-	depends on LEDS_CLASS
-	select LEDS_TRIGGERS
-	select LEDS_TRIGGER_DISK
-	help
-	  This option makes the front LED default to the disk trigger
-	  so that it blinks on disk activity.
-
 config PMAC_SMU
 	bool "Support for SMU  based PowerMacs"
 	depends on PPC_PMAC64
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index ae067ab2373d..838dcf98f82e 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -25,6 +25,7 @@ 
 #include <linux/leds.h>
 #include <linux/adb.h>
 #include <linux/pmu.h>
+#include <linux/moduleparam.h>
 #include <asm/prom.h>
 
 static spinlock_t pmu_blink_lock;
@@ -71,11 +72,10 @@  static void pmu_led_set(struct led_classdev *led_cdev,
  	spin_unlock_irqrestore(&pmu_blink_lock, flags);
 }
 
+int adb_pmu_led_disk;
+
 static struct led_classdev pmu_led = {
 	.name = "pmu-led::front",
-#ifdef CONFIG_ADB_PMU_LED_DISK
-	.default_trigger = "disk-activity",
-#endif
 	.brightness_set = pmu_led_set,
 };
 
@@ -106,6 +106,9 @@  static int __init via_pmu_led_init(void)
 	}
 	of_node_put(dt);
 
+	if (adb_pmu_led_disk)
+		pmu_led.default_trigger = "disk-activity";
+
 	spin_lock_init(&pmu_blink_lock);
 	/* no outstanding req */
 	pmu_blink_req.complete = 1;
@@ -114,4 +117,6 @@  static int __init via_pmu_led_init(void)
 	return led_classdev_register(NULL, &pmu_led);
 }
 
+core_param(adb_pmu_led_disk, adb_pmu_led_disk, bool, 0644);
+
 late_initcall(via_pmu_led_init);