linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/misc: Aspeed LPC control fix compile error and warning
@ 2017-03-22  3:13 Cyril Bur
  2017-03-22  6:06 ` Greg KH
  2017-03-22  6:09 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Cyril Bur @ 2017-03-22  3:13 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, joel, benh, linux-next

pgprot_dmachoerent() is not defined on every architecture. Having
COMPILE_TEST set for the driver causes it to be compiled on
architectures which do not have pgprot_dmachoerent():
    drivers/misc/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_mmap':
    drivers/misc/aspeed-lpc-ctrl.c:51:9: error: implicit declaration of
        function 'pgprot_dmacoherent' [-Werror=implicit-function-declaration]
        prot = pgprot_dmacoherent(prot);

There are two possible solutions:
    1. Remove COMPILE_TEST to ensure the driver is only compiled on ARM
    2. Use pgprot_noncached() instead of pgprot_dmachoerent()

The first option results in less compile testing of the LPC control
driver which is undesirable.
The second option uses a function that is declared on all architectures
and therefore should always build. Currently there is no practical
difference between pgprot_noncached() and pgprot_dmachoerent() for the
aspeed chips that this driver is compatible with. The reason for
pgprot_dmachoerent() was that there may be chips made at some point in
the future that could include hardware that pgprot_dmachoerent() could
optimise for. As none of this hardware has even been announced there
isn't really a need for pgprot_dmachoerent().

Using pgprot_noncached() is completely correct and optimal for all
existing hardware on which the LPC control driver will run.

This commit also addresses that phys_addr_t should be printed using %pap
rather than %x:
    In file included from include/linux/miscdevice.h:6:0,
                     from drivers/misc/aspeed-lpc-ctrl.c:11:
    drivers/misc/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_probe':
    drivers/misc/aspeed-lpc-ctrl.c:232:17: warning: format '%x' expects
        argument of type 'unsigned int', but argument 3 has type 'phys_addr_t
        {aka long long unsigned int}' [-Wformat=]
        dev_info(dev, "Loaded at 0x%08x (0x%08x)\n",

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
---
 drivers/misc/aspeed-lpc-ctrl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c
index f6acbe1d9378..c654651a7b6d 100644
--- a/drivers/misc/aspeed-lpc-ctrl.c
+++ b/drivers/misc/aspeed-lpc-ctrl.c
@@ -48,7 +48,7 @@ static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma)
 		return -EINVAL;
 
 	/* ast2400/2500 AHB accesses are not cache coherent */
-	prot = pgprot_dmacoherent(prot);
+	prot = pgprot_noncached(prot);
 
 	if (remap_pfn_range(vma, vma->vm_start,
 		(lpc_ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff,
@@ -229,8 +229,8 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
 	if (rc)
 		dev_err(dev, "Unable to register device\n");
 	else
-		dev_info(dev, "Loaded at 0x%08x (0x%08x)\n",
-			lpc_ctrl->mem_base, lpc_ctrl->mem_size);
+		dev_info(dev, "Loaded at %pap (0x%08x)\n",
+			&lpc_ctrl->mem_base, lpc_ctrl->mem_size);
 
 	return rc;
 }
-- 
2.12.0

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

* Re: [PATCH] drivers/misc: Aspeed LPC control fix compile error and warning
  2017-03-22  3:13 [PATCH] drivers/misc: Aspeed LPC control fix compile error and warning Cyril Bur
@ 2017-03-22  6:06 ` Greg KH
  2017-03-22  6:09 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-03-22  6:06 UTC (permalink / raw)
  To: Cyril Bur; +Cc: linux-kernel, joel, benh, linux-next

On Wed, Mar 22, 2017 at 02:13:28PM +1100, Cyril Bur wrote:
> pgprot_dmachoerent() is not defined on every architecture. Having
> COMPILE_TEST set for the driver causes it to be compiled on
> architectures which do not have pgprot_dmachoerent():
>     drivers/misc/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_mmap':
>     drivers/misc/aspeed-lpc-ctrl.c:51:9: error: implicit declaration of
>         function 'pgprot_dmacoherent' [-Werror=implicit-function-declaration]
>         prot = pgprot_dmacoherent(prot);
> 
> There are two possible solutions:
>     1. Remove COMPILE_TEST to ensure the driver is only compiled on ARM
>     2. Use pgprot_noncached() instead of pgprot_dmachoerent()
> 
> The first option results in less compile testing of the LPC control
> driver which is undesirable.
> The second option uses a function that is declared on all architectures
> and therefore should always build. Currently there is no practical
> difference between pgprot_noncached() and pgprot_dmachoerent() for the
> aspeed chips that this driver is compatible with. The reason for
> pgprot_dmachoerent() was that there may be chips made at some point in
> the future that could include hardware that pgprot_dmachoerent() could
> optimise for. As none of this hardware has even been announced there
> isn't really a need for pgprot_dmachoerent().
> 
> Using pgprot_noncached() is completely correct and optimal for all
> existing hardware on which the LPC control driver will run.
> 
> This commit also addresses that phys_addr_t should be printed using %pap
> rather than %x:
>     In file included from include/linux/miscdevice.h:6:0,
>                      from drivers/misc/aspeed-lpc-ctrl.c:11:
>     drivers/misc/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_probe':
>     drivers/misc/aspeed-lpc-ctrl.c:232:17: warning: format '%x' expects
>         argument of type 'unsigned int', but argument 3 has type 'phys_addr_t
>         {aka long long unsigned int}' [-Wformat=]
>         dev_info(dev, "Loaded at 0x%08x (0x%08x)\n",
> 
> Signed-off-by: Cyril Bur <cyrilbur@gmail.com>

You forgot to include a "Reported-by:" line here giving credit to who
pointed this out (the kbuild bot).  I'll go add it myself...

thanks,

greg k-h

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

* Re: [PATCH] drivers/misc: Aspeed LPC control fix compile error and warning
  2017-03-22  3:13 [PATCH] drivers/misc: Aspeed LPC control fix compile error and warning Cyril Bur
  2017-03-22  6:06 ` Greg KH
@ 2017-03-22  6:09 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-03-22  6:09 UTC (permalink / raw)
  To: Cyril Bur; +Cc: linux-kernel, joel, benh, linux-next

On Wed, Mar 22, 2017 at 02:13:28PM +1100, Cyril Bur wrote:
> pgprot_dmachoerent() is not defined on every architecture. Having
> COMPILE_TEST set for the driver causes it to be compiled on
> architectures which do not have pgprot_dmachoerent():
>     drivers/misc/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_mmap':
>     drivers/misc/aspeed-lpc-ctrl.c:51:9: error: implicit declaration of
>         function 'pgprot_dmacoherent' [-Werror=implicit-function-declaration]
>         prot = pgprot_dmacoherent(prot);
> 
> There are two possible solutions:
>     1. Remove COMPILE_TEST to ensure the driver is only compiled on ARM
>     2. Use pgprot_noncached() instead of pgprot_dmachoerent()
> 
> The first option results in less compile testing of the LPC control
> driver which is undesirable.
> The second option uses a function that is declared on all architectures
> and therefore should always build. Currently there is no practical
> difference between pgprot_noncached() and pgprot_dmachoerent() for the
> aspeed chips that this driver is compatible with. The reason for
> pgprot_dmachoerent() was that there may be chips made at some point in
> the future that could include hardware that pgprot_dmachoerent() could
> optimise for. As none of this hardware has even been announced there
> isn't really a need for pgprot_dmachoerent().
> 
> Using pgprot_noncached() is completely correct and optimal for all
> existing hardware on which the LPC control driver will run.
> 
> This commit also addresses that phys_addr_t should be printed using %pap
> rather than %x:

Also in the future, only do one thing per-patch, this is two different
things at the same time.  I'll take this for now, but please be more
careful going forward.

thanks,

greg k-h

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

end of thread, other threads:[~2017-03-22  6:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-22  3:13 [PATCH] drivers/misc: Aspeed LPC control fix compile error and warning Cyril Bur
2017-03-22  6:06 ` Greg KH
2017-03-22  6:09 ` Greg KH

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