linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] EDAC, altera: skip defining unused structures for specific configs
@ 2021-06-01  9:27 Krzysztof Kozlowski
  2021-07-05 15:13 ` Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-01  9:27 UTC (permalink / raw)
  To: Dinh Nguyen, Borislav Petkov, Mauro Carvalho Chehab, Tony Luck,
	James Morse, Robert Richter, linux-edac, linux-kernel
  Cc: Krzysztof Kozlowski, kernel test robot

The Altera EDAC driver has several features conditionally built
depending on Kconfig options.  The edac_device_prv_data structures are
conditionally used in of_device_id tables.  They reference other
functions and structures which can be defined as __maybe_unused.  This
silences build warnings like:

    drivers/edac/altera_edac.c:643:37: warning:
        ‘altr_edac_device_inject_fops’ defined but not used [-Wunused-const-variable=]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/edac/altera_edac.c | 44 ++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 61c21bd880a4..2949edb93454 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -539,10 +539,18 @@ module_platform_driver(altr_edac_driver);
  * trigger testing are different for each memory.
  */
 
+#ifdef CONFIG_EDAC_ALTERA_OCRAM
 static const struct edac_device_prv_data ocramecc_data;
+#endif
+#ifdef CONFIG_EDAC_ALTERA_L2C
 static const struct edac_device_prv_data l2ecc_data;
+#endif
+#ifdef CONFIG_EDAC_ALTERA_OCRAM
 static const struct edac_device_prv_data a10_ocramecc_data;
+#endif
+#ifdef CONFIG_EDAC_ALTERA_L2C
 static const struct edac_device_prv_data a10_l2ecc_data;
+#endif
 
 static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
 {
@@ -569,9 +577,9 @@ static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
 	return ret_value;
 }
 
-static ssize_t altr_edac_device_trig(struct file *file,
-				     const char __user *user_buf,
-				     size_t count, loff_t *ppos)
+static ssize_t __maybe_unused
+altr_edac_device_trig(struct file *file, const char __user *user_buf,
+		      size_t count, loff_t *ppos)
 
 {
 	u32 *ptemp, i, error_mask;
@@ -640,27 +648,27 @@ static ssize_t altr_edac_device_trig(struct file *file,
 	return count;
 }
 
-static const struct file_operations altr_edac_device_inject_fops = {
+static const struct file_operations altr_edac_device_inject_fops __maybe_unused = {
 	.open = simple_open,
 	.write = altr_edac_device_trig,
 	.llseek = generic_file_llseek,
 };
 
-static ssize_t altr_edac_a10_device_trig(struct file *file,
-					 const char __user *user_buf,
-					 size_t count, loff_t *ppos);
+static ssize_t __maybe_unused
+altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
+			  size_t count, loff_t *ppos);
 
-static const struct file_operations altr_edac_a10_device_inject_fops = {
+static const struct file_operations altr_edac_a10_device_inject_fops __maybe_unused = {
 	.open = simple_open,
 	.write = altr_edac_a10_device_trig,
 	.llseek = generic_file_llseek,
 };
 
-static ssize_t altr_edac_a10_device_trig2(struct file *file,
-					  const char __user *user_buf,
-					  size_t count, loff_t *ppos);
+static ssize_t __maybe_unused
+altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
+			   size_t count, loff_t *ppos);
 
-static const struct file_operations altr_edac_a10_device_inject2_fops = {
+static const struct file_operations altr_edac_a10_device_inject2_fops __maybe_unused = {
 	.open = simple_open,
 	.write = altr_edac_a10_device_trig2,
 	.llseek = generic_file_llseek,
@@ -1697,9 +1705,9 @@ MODULE_DEVICE_TABLE(of, altr_edac_a10_device_of_match);
  * Based on xgene_edac.c peripheral code.
  */
 
-static ssize_t altr_edac_a10_device_trig(struct file *file,
-					 const char __user *user_buf,
-					 size_t count, loff_t *ppos)
+static ssize_t __maybe_unused
+altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
+			  size_t count, loff_t *ppos)
 {
 	struct edac_device_ctl_info *edac_dci = file->private_data;
 	struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
@@ -1729,9 +1737,9 @@ static ssize_t altr_edac_a10_device_trig(struct file *file,
  * slightly. A few Arria10 peripherals can use this injection function.
  * Inject the error into the memory and then readback to trigger the IRQ.
  */
-static ssize_t altr_edac_a10_device_trig2(struct file *file,
-					  const char __user *user_buf,
-					  size_t count, loff_t *ppos)
+static ssize_t __maybe_unused
+altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
+			   size_t count, loff_t *ppos)
 {
 	struct edac_device_ctl_info *edac_dci = file->private_data;
 	struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
-- 
2.27.0


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

* Re: [PATCH] EDAC, altera: skip defining unused structures for specific configs
  2021-06-01  9:27 [PATCH] EDAC, altera: skip defining unused structures for specific configs Krzysztof Kozlowski
@ 2021-07-05 15:13 ` Krzysztof Kozlowski
  2021-07-09 14:16 ` Dinh Nguyen
  2021-08-16 18:33 ` Borislav Petkov
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-05 15:13 UTC (permalink / raw)
  To: Dinh Nguyen, Borislav Petkov, Mauro Carvalho Chehab, Tony Luck,
	James Morse, Robert Richter, linux-edac, linux-kernel
  Cc: kernel test robot

On 01/06/2021 11:27, Krzysztof Kozlowski wrote:
> The Altera EDAC driver has several features conditionally built
> depending on Kconfig options.  The edac_device_prv_data structures are
> conditionally used in of_device_id tables.  They reference other
> functions and structures which can be defined as __maybe_unused.  This
> silences build warnings like:
> 
>     drivers/edac/altera_edac.c:643:37: warning:
>         ‘altr_edac_device_inject_fops’ defined but not used [-Wunused-const-variable=]
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/edac/altera_edac.c | 44 ++++++++++++++++++++++----------------
>  1 file changed, 26 insertions(+), 18 deletions(-)

Hi Altera and EDAC maintainers,

Any comments on this patch?

Best regards,
Krzysztof

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

* Re: [PATCH] EDAC, altera: skip defining unused structures for specific configs
  2021-06-01  9:27 [PATCH] EDAC, altera: skip defining unused structures for specific configs Krzysztof Kozlowski
  2021-07-05 15:13 ` Krzysztof Kozlowski
@ 2021-07-09 14:16 ` Dinh Nguyen
  2021-08-16 18:33 ` Borislav Petkov
  2 siblings, 0 replies; 4+ messages in thread
From: Dinh Nguyen @ 2021-07-09 14:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Borislav Petkov, Mauro Carvalho Chehab,
	Tony Luck, James Morse, Robert Richter, linux-edac, linux-kernel
  Cc: kernel test robot



On 6/1/21 4:27 AM, Krzysztof Kozlowski wrote:
> The Altera EDAC driver has several features conditionally built
> depending on Kconfig options.  The edac_device_prv_data structures are
> conditionally used in of_device_id tables.  They reference other
> functions and structures which can be defined as __maybe_unused.  This
> silences build warnings like:
> 
>      drivers/edac/altera_edac.c:643:37: warning:
>          ‘altr_edac_device_inject_fops’ defined but not used [-Wunused-const-variable=]
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>   drivers/edac/altera_edac.c | 44 ++++++++++++++++++++++----------------
>   1 file changed, 26 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index 61c21bd880a4..2949edb93454 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -539,10 +539,18 @@ module_platform_driver(altr_edac_driver);
>    * trigger testing are different for each memory.
>    */
>   
> +#ifdef CONFIG_EDAC_ALTERA_OCRAM
>   static const struct edac_device_prv_data ocramecc_data;
> +#endif
> +#ifdef CONFIG_EDAC_ALTERA_L2C
>   static const struct edac_device_prv_data l2ecc_data;
> +#endif
> +#ifdef CONFIG_EDAC_ALTERA_OCRAM
>   static const struct edac_device_prv_data a10_ocramecc_data;
> +#endif
> +#ifdef CONFIG_EDAC_ALTERA_L2C
>   static const struct edac_device_prv_data a10_l2ecc_data;
> +#endif
>   
>   static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
>   {
> @@ -569,9 +577,9 @@ static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
>   	return ret_value;
>   }
>   
> -static ssize_t altr_edac_device_trig(struct file *file,
> -				     const char __user *user_buf,
> -				     size_t count, loff_t *ppos)
> +static ssize_t __maybe_unused
> +altr_edac_device_trig(struct file *file, const char __user *user_buf,
> +		      size_t count, loff_t *ppos)
>   
>   {
>   	u32 *ptemp, i, error_mask;
> @@ -640,27 +648,27 @@ static ssize_t altr_edac_device_trig(struct file *file,
>   	return count;
>   }
>   
> -static const struct file_operations altr_edac_device_inject_fops = {
> +static const struct file_operations altr_edac_device_inject_fops __maybe_unused = {
>   	.open = simple_open,
>   	.write = altr_edac_device_trig,
>   	.llseek = generic_file_llseek,
>   };
>   
> -static ssize_t altr_edac_a10_device_trig(struct file *file,
> -					 const char __user *user_buf,
> -					 size_t count, loff_t *ppos);
> +static ssize_t __maybe_unused
> +altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
> +			  size_t count, loff_t *ppos);
>   
> -static const struct file_operations altr_edac_a10_device_inject_fops = {
> +static const struct file_operations altr_edac_a10_device_inject_fops __maybe_unused = {
>   	.open = simple_open,
>   	.write = altr_edac_a10_device_trig,
>   	.llseek = generic_file_llseek,
>   };
>   
> -static ssize_t altr_edac_a10_device_trig2(struct file *file,
> -					  const char __user *user_buf,
> -					  size_t count, loff_t *ppos);
> +static ssize_t __maybe_unused
> +altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
> +			   size_t count, loff_t *ppos);
>   
> -static const struct file_operations altr_edac_a10_device_inject2_fops = {
> +static const struct file_operations altr_edac_a10_device_inject2_fops __maybe_unused = {
>   	.open = simple_open,
>   	.write = altr_edac_a10_device_trig2,
>   	.llseek = generic_file_llseek,
> @@ -1697,9 +1705,9 @@ MODULE_DEVICE_TABLE(of, altr_edac_a10_device_of_match);
>    * Based on xgene_edac.c peripheral code.
>    */
>   
> -static ssize_t altr_edac_a10_device_trig(struct file *file,
> -					 const char __user *user_buf,
> -					 size_t count, loff_t *ppos)
> +static ssize_t __maybe_unused
> +altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
> +			  size_t count, loff_t *ppos)
>   {
>   	struct edac_device_ctl_info *edac_dci = file->private_data;
>   	struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
> @@ -1729,9 +1737,9 @@ static ssize_t altr_edac_a10_device_trig(struct file *file,
>    * slightly. A few Arria10 peripherals can use this injection function.
>    * Inject the error into the memory and then readback to trigger the IRQ.
>    */
> -static ssize_t altr_edac_a10_device_trig2(struct file *file,
> -					  const char __user *user_buf,
> -					  size_t count, loff_t *ppos)
> +static ssize_t __maybe_unused
> +altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
> +			   size_t count, loff_t *ppos)
>   {
>   	struct edac_device_ctl_info *edac_dci = file->private_data;
>   	struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
> 

Acked-by: Dinh Nguyen <dinguyen@kernel.org>

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

* Re: [PATCH] EDAC, altera: skip defining unused structures for specific configs
  2021-06-01  9:27 [PATCH] EDAC, altera: skip defining unused structures for specific configs Krzysztof Kozlowski
  2021-07-05 15:13 ` Krzysztof Kozlowski
  2021-07-09 14:16 ` Dinh Nguyen
@ 2021-08-16 18:33 ` Borislav Petkov
  2 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2021-08-16 18:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dinh Nguyen, Mauro Carvalho Chehab, Tony Luck, James Morse,
	Robert Richter, linux-edac, linux-kernel, kernel test robot

On Tue, Jun 01, 2021 at 11:27:04AM +0200, Krzysztof Kozlowski wrote:
> The Altera EDAC driver has several features conditionally built
> depending on Kconfig options.  The edac_device_prv_data structures are
> conditionally used in of_device_id tables.  They reference other
> functions and structures which can be defined as __maybe_unused.  This
> silences build warnings like:
> 
>     drivers/edac/altera_edac.c:643:37: warning:
>         ‘altr_edac_device_inject_fops’ defined but not used [-Wunused-const-variable=]
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/edac/altera_edac.c | 44 ++++++++++++++++++++++----------------
>  1 file changed, 26 insertions(+), 18 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

end of thread, other threads:[~2021-08-16 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01  9:27 [PATCH] EDAC, altera: skip defining unused structures for specific configs Krzysztof Kozlowski
2021-07-05 15:13 ` Krzysztof Kozlowski
2021-07-09 14:16 ` Dinh Nguyen
2021-08-16 18:33 ` Borislav Petkov

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).