2019-10-11 08:37:45

by Jon Hunter

[permalink] [raw]
Subject: [PATCH] mailbox: tegra: Fix superfluous IRQ error message

Commit 7723f4c5ecdb ("driver core: platform: Add an error message to
platform_get_irq*()") added an error message to avoid drivers having
to print an error message when IRQ lookup fails. However, there are
some cases where IRQs are optional and so new optional versions of
the platform_get_irq*() APIs have been added for these cases.

The IRQs for Tegra HSP module are optional because not all instances
of the module have the doorbell and all of the shared interrupts.
Hence, since the above commit was applied the following error messages
are now seen on Tegra194 ...

ERR KERN tegra-hsp c150000.hsp: IRQ doorbell not found
ERR KERN tegra-hsp c150000.hsp: IRQ shared0 not found

The Tegra HSP driver deliberately does not fail if these are not found
and so fix the above errors by updating the Tegra HSP driver to use
the platform_get_irq_byname_optional() API.

Signed-off-by: Jon Hunter <[email protected]>
---
drivers/mailbox/tegra-hsp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index 4c5ba35d48d4..834b35dc3b13 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -657,7 +657,7 @@ static int tegra_hsp_probe(struct platform_device *pdev)
hsp->num_db = (value >> HSP_nDB_SHIFT) & HSP_nINT_MASK;
hsp->num_si = (value >> HSP_nSI_SHIFT) & HSP_nINT_MASK;

- err = platform_get_irq_byname(pdev, "doorbell");
+ err = platform_get_irq_byname_optional(pdev, "doorbell");
if (err >= 0)
hsp->doorbell_irq = err;

@@ -677,7 +677,7 @@ static int tegra_hsp_probe(struct platform_device *pdev)
if (!name)
return -ENOMEM;

- err = platform_get_irq_byname(pdev, name);
+ err = platform_get_irq_byname_optional(pdev, name);
if (err >= 0) {
hsp->shared_irqs[i] = err;
count++;
--
2.17.1


2019-10-14 08:15:50

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] mailbox: tegra: Fix superfluous IRQ error message

Hi Jon,

I love your patch! Yet something to improve:

[auto build test ERROR on tegra/for-next]
[cannot apply to v5.4-rc3 next-20191011]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Jon-Hunter/mailbox-tegra-Fix-superfluous-IRQ-error-message/20191014-052329
base: https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers//mailbox/tegra-hsp.c: In function 'tegra_hsp_probe':
>> drivers//mailbox/tegra-hsp.c:660:8: error: implicit declaration of function 'platform_get_irq_byname_optional'; did you mean 'platform_get_irq_optional'? [-Werror=implicit-function-declaration]
err = platform_get_irq_byname_optional(pdev, "doorbell");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
platform_get_irq_optional
cc1: some warnings being treated as errors

vim +660 drivers//mailbox/tegra-hsp.c

630
631 static int tegra_hsp_probe(struct platform_device *pdev)
632 {
633 struct tegra_hsp *hsp;
634 struct resource *res;
635 unsigned int i;
636 u32 value;
637 int err;
638
639 hsp = devm_kzalloc(&pdev->dev, sizeof(*hsp), GFP_KERNEL);
640 if (!hsp)
641 return -ENOMEM;
642
643 hsp->dev = &pdev->dev;
644 hsp->soc = of_device_get_match_data(&pdev->dev);
645 INIT_LIST_HEAD(&hsp->doorbells);
646 spin_lock_init(&hsp->lock);
647
648 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
649 hsp->regs = devm_ioremap_resource(&pdev->dev, res);
650 if (IS_ERR(hsp->regs))
651 return PTR_ERR(hsp->regs);
652
653 value = tegra_hsp_readl(hsp, HSP_INT_DIMENSIONING);
654 hsp->num_sm = (value >> HSP_nSM_SHIFT) & HSP_nINT_MASK;
655 hsp->num_ss = (value >> HSP_nSS_SHIFT) & HSP_nINT_MASK;
656 hsp->num_as = (value >> HSP_nAS_SHIFT) & HSP_nINT_MASK;
657 hsp->num_db = (value >> HSP_nDB_SHIFT) & HSP_nINT_MASK;
658 hsp->num_si = (value >> HSP_nSI_SHIFT) & HSP_nINT_MASK;
659
> 660 err = platform_get_irq_byname_optional(pdev, "doorbell");
661 if (err >= 0)
662 hsp->doorbell_irq = err;
663
664 if (hsp->num_si > 0) {
665 unsigned int count = 0;
666
667 hsp->shared_irqs = devm_kcalloc(&pdev->dev, hsp->num_si,
668 sizeof(*hsp->shared_irqs),
669 GFP_KERNEL);
670 if (!hsp->shared_irqs)
671 return -ENOMEM;
672
673 for (i = 0; i < hsp->num_si; i++) {
674 char *name;
675
676 name = kasprintf(GFP_KERNEL, "shared%u", i);
677 if (!name)
678 return -ENOMEM;
679
680 err = platform_get_irq_byname_optional(pdev, name);
681 if (err >= 0) {
682 hsp->shared_irqs[i] = err;
683 count++;
684 }
685
686 kfree(name);
687 }
688
689 if (count == 0) {
690 devm_kfree(&pdev->dev, hsp->shared_irqs);
691 hsp->shared_irqs = NULL;
692 }
693 }
694
695 /* setup the doorbell controller */
696 hsp->mbox_db.of_xlate = tegra_hsp_db_xlate;
697 hsp->mbox_db.num_chans = 32;
698 hsp->mbox_db.dev = &pdev->dev;
699 hsp->mbox_db.ops = &tegra_hsp_db_ops;
700
701 hsp->mbox_db.chans = devm_kcalloc(&pdev->dev, hsp->mbox_db.num_chans,
702 sizeof(*hsp->mbox_db.chans),
703 GFP_KERNEL);
704 if (!hsp->mbox_db.chans)
705 return -ENOMEM;
706
707 if (hsp->doorbell_irq) {
708 err = tegra_hsp_add_doorbells(hsp);
709 if (err < 0) {
710 dev_err(&pdev->dev, "failed to add doorbells: %d\n",
711 err);
712 return err;
713 }
714 }
715
716 err = devm_mbox_controller_register(&pdev->dev, &hsp->mbox_db);
717 if (err < 0) {
718 dev_err(&pdev->dev, "failed to register doorbell mailbox: %d\n",
719 err);
720 return err;
721 }
722
723 /* setup the shared mailbox controller */
724 hsp->mbox_sm.of_xlate = tegra_hsp_sm_xlate;
725 hsp->mbox_sm.num_chans = hsp->num_sm;
726 hsp->mbox_sm.dev = &pdev->dev;
727 hsp->mbox_sm.ops = &tegra_hsp_sm_ops;
728
729 hsp->mbox_sm.chans = devm_kcalloc(&pdev->dev, hsp->mbox_sm.num_chans,
730 sizeof(*hsp->mbox_sm.chans),
731 GFP_KERNEL);
732 if (!hsp->mbox_sm.chans)
733 return -ENOMEM;
734
735 if (hsp->shared_irqs) {
736 err = tegra_hsp_add_mailboxes(hsp, &pdev->dev);
737 if (err < 0) {
738 dev_err(&pdev->dev, "failed to add mailboxes: %d\n",
739 err);
740 return err;
741 }
742 }
743
744 err = devm_mbox_controller_register(&pdev->dev, &hsp->mbox_sm);
745 if (err < 0) {
746 dev_err(&pdev->dev, "failed to register shared mailbox: %d\n",
747 err);
748 return err;
749 }
750
751 platform_set_drvdata(pdev, hsp);
752
753 if (hsp->doorbell_irq) {
754 err = devm_request_irq(&pdev->dev, hsp->doorbell_irq,
755 tegra_hsp_doorbell_irq, IRQF_NO_SUSPEND,
756 dev_name(&pdev->dev), hsp);
757 if (err < 0) {
758 dev_err(&pdev->dev,
759 "failed to request doorbell IRQ#%u: %d\n",
760 hsp->doorbell_irq, err);
761 return err;
762 }
763 }
764
765 if (hsp->shared_irqs) {
766 err = tegra_hsp_request_shared_irq(hsp);
767 if (err < 0)
768 return err;
769 }
770
771 return 0;
772 }
773

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


Attachments:
(No filename) (6.23 kB)
.config.gz (70.29 kB)
Download all attachments

2019-10-14 13:26:37

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] mailbox: tegra: Fix superfluous IRQ error message

On Fri, Oct 11, 2019 at 09:34:59AM +0100, Jon Hunter wrote:
> Commit 7723f4c5ecdb ("driver core: platform: Add an error message to
> platform_get_irq*()") added an error message to avoid drivers having
> to print an error message when IRQ lookup fails. However, there are
> some cases where IRQs are optional and so new optional versions of
> the platform_get_irq*() APIs have been added for these cases.
>
> The IRQs for Tegra HSP module are optional because not all instances
> of the module have the doorbell and all of the shared interrupts.
> Hence, since the above commit was applied the following error messages
> are now seen on Tegra194 ...
>
> ERR KERN tegra-hsp c150000.hsp: IRQ doorbell not found
> ERR KERN tegra-hsp c150000.hsp: IRQ shared0 not found
>
> The Tegra HSP driver deliberately does not fail if these are not found
> and so fix the above errors by updating the Tegra HSP driver to use
> the platform_get_irq_byname_optional() API.
>
> Signed-off-by: Jon Hunter <[email protected]>
> ---
> drivers/mailbox/tegra-hsp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Perhaps Greg should pick up this patch because he's carrying the patch
that adds the platform_get_irq_byname_optional() patch for v5.5.

Greg, would you prefer a copy of this in your mailbox, or does the
following patchwork link suffice:

http://patchwork.ozlabs.org/patch/1175012/

Either way, this patch:

Acked-by: Thierry Reding <[email protected]>

Thierry


Attachments:
(No filename) (1.48 kB)
signature.asc (849.00 B)
Download all attachments

2019-11-12 12:04:06

by Jon Hunter

[permalink] [raw]
Subject: Re: [PATCH] mailbox: tegra: Fix superfluous IRQ error message

Hi Greg,

On 14/10/2019 14:24, Thierry Reding wrote:
> On Fri, Oct 11, 2019 at 09:34:59AM +0100, Jon Hunter wrote:
>> Commit 7723f4c5ecdb ("driver core: platform: Add an error message to
>> platform_get_irq*()") added an error message to avoid drivers having
>> to print an error message when IRQ lookup fails. However, there are
>> some cases where IRQs are optional and so new optional versions of
>> the platform_get_irq*() APIs have been added for these cases.
>>
>> The IRQs for Tegra HSP module are optional because not all instances
>> of the module have the doorbell and all of the shared interrupts.
>> Hence, since the above commit was applied the following error messages
>> are now seen on Tegra194 ...
>>
>> ERR KERN tegra-hsp c150000.hsp: IRQ doorbell not found
>> ERR KERN tegra-hsp c150000.hsp: IRQ shared0 not found
>>
>> The Tegra HSP driver deliberately does not fail if these are not found
>> and so fix the above errors by updating the Tegra HSP driver to use
>> the platform_get_irq_byname_optional() API.
>>
>> Signed-off-by: Jon Hunter <[email protected]>
>> ---
>> drivers/mailbox/tegra-hsp.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Perhaps Greg should pick up this patch because he's carrying the patch
> that adds the platform_get_irq_byname_optional() patch for v5.5.
>
> Greg, would you prefer a copy of this in your mailbox, or does the
> following patchwork link suffice:
>
> http://patchwork.ozlabs.org/patch/1175012/
>
> Either way, this patch:
>
> Acked-by: Thierry Reding <[email protected]>
>
> Thierry

Are you OK to pick this up? Do you need Jassi's ACK as well?

Thanks!
Jon

--
nvpublic

2019-11-12 14:12:33

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] mailbox: tegra: Fix superfluous IRQ error message

On Tue, Nov 12, 2019 at 12:02:02PM +0000, Jon Hunter wrote:
> Hi Greg,
>
> On 14/10/2019 14:24, Thierry Reding wrote:
> > On Fri, Oct 11, 2019 at 09:34:59AM +0100, Jon Hunter wrote:
> >> Commit 7723f4c5ecdb ("driver core: platform: Add an error message to
> >> platform_get_irq*()") added an error message to avoid drivers having
> >> to print an error message when IRQ lookup fails. However, there are
> >> some cases where IRQs are optional and so new optional versions of
> >> the platform_get_irq*() APIs have been added for these cases.
> >>
> >> The IRQs for Tegra HSP module are optional because not all instances
> >> of the module have the doorbell and all of the shared interrupts.
> >> Hence, since the above commit was applied the following error messages
> >> are now seen on Tegra194 ...
> >>
> >> ERR KERN tegra-hsp c150000.hsp: IRQ doorbell not found
> >> ERR KERN tegra-hsp c150000.hsp: IRQ shared0 not found
> >>
> >> The Tegra HSP driver deliberately does not fail if these are not found
> >> and so fix the above errors by updating the Tegra HSP driver to use
> >> the platform_get_irq_byname_optional() API.
> >>
> >> Signed-off-by: Jon Hunter <[email protected]>
> >> ---
> >> drivers/mailbox/tegra-hsp.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > Perhaps Greg should pick up this patch because he's carrying the patch
> > that adds the platform_get_irq_byname_optional() patch for v5.5.
> >
> > Greg, would you prefer a copy of this in your mailbox, or does the
> > following patchwork link suffice:
> >
> > http://patchwork.ozlabs.org/patch/1175012/
> >
> > Either way, this patch:
> >
> > Acked-by: Thierry Reding <[email protected]>
> >
> > Thierry
>
> Are you OK to pick this up? Do you need Jassi's ACK as well?

Sorry, I'll take it as-is, it should be fine.

greg k-h