Skip to content

Commit 7d07deb

Browse files
krzksuryasaimadhu
authored andcommitted
EDAC/altera: Skip defining unused structures for specific configs
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. Silence 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> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Dinh Nguyen <dinguyen@kernel.org> Link: https://lkml.kernel.org/r/20210601092704.203555-1-krzysztof.kozlowski@canonical.com
1 parent 767f4b6 commit 7d07deb

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

drivers/edac/altera_edac.c

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,18 @@ module_platform_driver(altr_edac_driver);
539539
* trigger testing are different for each memory.
540540
*/
541541

542+
#ifdef CONFIG_EDAC_ALTERA_OCRAM
542543
static const struct edac_device_prv_data ocramecc_data;
544+
#endif
545+
#ifdef CONFIG_EDAC_ALTERA_L2C
543546
static const struct edac_device_prv_data l2ecc_data;
547+
#endif
548+
#ifdef CONFIG_EDAC_ALTERA_OCRAM
544549
static const struct edac_device_prv_data a10_ocramecc_data;
550+
#endif
551+
#ifdef CONFIG_EDAC_ALTERA_L2C
545552
static const struct edac_device_prv_data a10_l2ecc_data;
553+
#endif
546554

547555
static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
548556
{
@@ -569,9 +577,9 @@ static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
569577
return ret_value;
570578
}
571579

572-
static ssize_t altr_edac_device_trig(struct file *file,
573-
const char __user *user_buf,
574-
size_t count, loff_t *ppos)
580+
static ssize_t __maybe_unused
581+
altr_edac_device_trig(struct file *file, const char __user *user_buf,
582+
size_t count, loff_t *ppos)
575583

576584
{
577585
u32 *ptemp, i, error_mask;
@@ -640,27 +648,27 @@ static ssize_t altr_edac_device_trig(struct file *file,
640648
return count;
641649
}
642650

643-
static const struct file_operations altr_edac_device_inject_fops = {
651+
static const struct file_operations altr_edac_device_inject_fops __maybe_unused = {
644652
.open = simple_open,
645653
.write = altr_edac_device_trig,
646654
.llseek = generic_file_llseek,
647655
};
648656

649-
static ssize_t altr_edac_a10_device_trig(struct file *file,
650-
const char __user *user_buf,
651-
size_t count, loff_t *ppos);
657+
static ssize_t __maybe_unused
658+
altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
659+
size_t count, loff_t *ppos);
652660

653-
static const struct file_operations altr_edac_a10_device_inject_fops = {
661+
static const struct file_operations altr_edac_a10_device_inject_fops __maybe_unused = {
654662
.open = simple_open,
655663
.write = altr_edac_a10_device_trig,
656664
.llseek = generic_file_llseek,
657665
};
658666

659-
static ssize_t altr_edac_a10_device_trig2(struct file *file,
660-
const char __user *user_buf,
661-
size_t count, loff_t *ppos);
667+
static ssize_t __maybe_unused
668+
altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
669+
size_t count, loff_t *ppos);
662670

663-
static const struct file_operations altr_edac_a10_device_inject2_fops = {
671+
static const struct file_operations altr_edac_a10_device_inject2_fops __maybe_unused = {
664672
.open = simple_open,
665673
.write = altr_edac_a10_device_trig2,
666674
.llseek = generic_file_llseek,
@@ -1697,9 +1705,9 @@ MODULE_DEVICE_TABLE(of, altr_edac_a10_device_of_match);
16971705
* Based on xgene_edac.c peripheral code.
16981706
*/
16991707

1700-
static ssize_t altr_edac_a10_device_trig(struct file *file,
1701-
const char __user *user_buf,
1702-
size_t count, loff_t *ppos)
1708+
static ssize_t __maybe_unused
1709+
altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
1710+
size_t count, loff_t *ppos)
17031711
{
17041712
struct edac_device_ctl_info *edac_dci = file->private_data;
17051713
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,
17291737
* slightly. A few Arria10 peripherals can use this injection function.
17301738
* Inject the error into the memory and then readback to trigger the IRQ.
17311739
*/
1732-
static ssize_t altr_edac_a10_device_trig2(struct file *file,
1733-
const char __user *user_buf,
1734-
size_t count, loff_t *ppos)
1740+
static ssize_t __maybe_unused
1741+
altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
1742+
size_t count, loff_t *ppos)
17351743
{
17361744
struct edac_device_ctl_info *edac_dci = file->private_data;
17371745
struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;

0 commit comments

Comments
 (0)