]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
drivers/misc: Aspeed LPC control fix compile error and warning
authorCyril Bur <cyrilbur@gmail.com>
Wed, 22 Mar 2017 03:13:28 +0000 (14:13 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2017 06:07:50 +0000 (07:07 +0100)
commit132c93d4215c5ea12f8bb291249ede159d507b6e
tree0e5472bb4b053e2156494dbd46bc46d8aa6e1743
parentac1ddc584e9817d9d0a4572f3245305d907c6e61
drivers/misc: Aspeed LPC control fix compile error and warning

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>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/aspeed-lpc-ctrl.c