diff mbox

[1/3] ACPI / APD: Provide build-in properties of the UART

Message ID 1471875855-110782-2-git-send-email-heikki.krogerus@linux.intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Heikki Krogerus Aug. 22, 2016, 2:24 p.m. UTC
The UART driver, dw8250.c, needs some details regarding the
Designware UART. For ACPI enumerated devices the values are
hard-coded, but since the driver also reads the values from
device properties, providing them with build-in properties.
This allows us to later remove the hard-coded values from
the driver.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Ken Xue <Ken.Xue@amd.com>
---
 drivers/acpi/acpi_apd.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

kernel test robot Aug. 22, 2016, 3 p.m. UTC | #1
Hi Heikki,

[auto build test ERROR on pm/linux-next]
[also build test ERROR on v4.8-rc3 next-20160822]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Heikki-Krogerus/ACPI-APD-Provide-build-in-properties-of-the-UART/20160822-222543
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-x016-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/acpi/acpi_apd.c: In function 'acpi_apd_setup':
>> drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
     if (pdata->properties)
              ^~
   drivers/acpi/acpi_apd.c:73:16: error: 'struct apd_private_data' has no member named 'properties'
              pdata->properties);
                   ^~

vim +71 drivers/acpi/acpi_apd.c

    65						dev_name(&pdata->adev->dev),
    66						NULL, 0, dev_desc->fixed_clk_rate);
    67			clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
    68			pdata->clk = clk;
    69		}
    70	
  > 71		if (pdata->properties)
    72			return device_add_properties(&pdata->adev->dev,
    73						     pdata->properties);
    74		return 0;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Aug. 22, 2016, 4:01 p.m. UTC | #2
Hi Heikki,

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.8-rc3 next-20160822]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Heikki-Krogerus/ACPI-APD-Provide-build-in-properties-of-the-UART/20160822-222543
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-s1-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/io.h:21,
                    from include/linux/clk-provider.h:14,
                    from drivers/acpi/acpi_apd.c:13:
   drivers/acpi/acpi_apd.c: In function 'acpi_apd_setup':
   drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
     if (pdata->properties)
              ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/acpi/acpi_apd.c:71:2: note: in expansion of macro 'if'
     if (pdata->properties)
     ^~
   drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
     if (pdata->properties)
              ^
   include/linux/compiler.h:149:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/acpi/acpi_apd.c:71:2: note: in expansion of macro 'if'
     if (pdata->properties)
     ^~
   drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
     if (pdata->properties)
              ^
   include/linux/compiler.h:160:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/acpi/acpi_apd.c:71:2: note: in expansion of macro 'if'
     if (pdata->properties)
     ^~
   drivers/acpi/acpi_apd.c:73:16: error: 'struct apd_private_data' has no member named 'properties'
              pdata->properties);
                   ^~

vim +/if +71 drivers/acpi/acpi_apd.c

     7	 *
     8	 * This program is free software; you can redistribute it and/or modify
     9	 * it under the terms of the GNU General Public License version 2 as
    10	 * published by the Free Software Foundation.
    11	 */
    12	
  > 13	#include <linux/clk-provider.h>
    14	#include <linux/platform_device.h>
    15	#include <linux/pm_domain.h>
    16	#include <linux/clkdev.h>
    17	#include <linux/acpi.h>
    18	#include <linux/err.h>
    19	#include <linux/pm.h>
    20	
    21	#include "internal.h"
    22	
    23	ACPI_MODULE_NAME("acpi_apd");
    24	struct apd_private_data;
    25	
    26	/**
    27	 * ACPI_APD_SYSFS : add device attributes in sysfs
    28	 * ACPI_APD_PM : attach power domain to device
    29	 */
    30	#define ACPI_APD_SYSFS	BIT(0)
    31	#define ACPI_APD_PM	BIT(1)
    32	
    33	/**
    34	 * struct apd_device_desc - a descriptor for apd device
    35	 * @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM
    36	 * @fixed_clk_rate: fixed rate input clock source for acpi device;
    37	 *			0 means no fixed rate input clock source
    38	 * @setup: a hook routine to set device resource during create platform device
    39	 *
    40	 * Device description defined as acpi_device_id.driver_data
    41	 */
    42	struct apd_device_desc {
    43		unsigned int flags;
    44		unsigned int fixed_clk_rate;
    45		struct property_entry *properties;
    46		int (*setup)(struct apd_private_data *pdata);
    47	};
    48	
    49	struct apd_private_data {
    50		struct clk *clk;
    51		struct acpi_device *adev;
    52		const struct apd_device_desc *dev_desc;
    53	};
    54	
    55	#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
    56	#define APD_ADDR(desc)	((unsigned long)&desc)
    57	
    58	static int acpi_apd_setup(struct apd_private_data *pdata)
    59	{
    60		const struct apd_device_desc *dev_desc = pdata->dev_desc;
    61		struct clk *clk = ERR_PTR(-ENODEV);
    62	
    63		if (dev_desc->fixed_clk_rate) {
    64			clk = clk_register_fixed_rate(&pdata->adev->dev,
    65						dev_name(&pdata->adev->dev),
    66						NULL, 0, dev_desc->fixed_clk_rate);
    67			clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
    68			pdata->clk = clk;
    69		}
    70	
  > 71		if (pdata->properties)
    72			return device_add_properties(&pdata->adev->dev,
    73						     pdata->properties);
    74		return 0;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Heikki Krogerus Aug. 23, 2016, 6:37 a.m. UTC | #3
Hi,

On Mon, Aug 22, 2016 at 11:00:49PM +0800, kbuild test robot wrote:
> Hi Heikki,
> 
> [auto build test ERROR on pm/linux-next]
> [also build test ERROR on v4.8-rc3 next-20160822]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
> [Check https://git-scm.com/docs/git-format-patch for more information]
> 
> url:    https://github.com/0day-ci/linux/commits/Heikki-Krogerus/ACPI-APD-Provide-build-in-properties-of-the-UART/20160822-222543
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
> config: x86_64-randconfig-x016-201634 (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/acpi/acpi_apd.c: In function 'acpi_apd_setup':
> >> drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
>      if (pdata->properties)
>               ^~
>    drivers/acpi/acpi_apd.c:73:16: error: 'struct apd_private_data' has no member named 'properties'
>               pdata->properties);
>                    ^~
> 
> vim +71 drivers/acpi/acpi_apd.c
> 
>     65						dev_name(&pdata->adev->dev),
>     66						NULL, 0, dev_desc->fixed_clk_rate);
>     67			clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
>     68			pdata->clk = clk;
>     69		}
>     70	
>   > 71		if (pdata->properties)

Thanks, I'll fix it. I did not get compiler error from this? Weird.


Br,
diff mbox

Patch

diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index c80c8f8..a51dbef 100644
--- a/drivers/acpi/acpi_apd.c
+++ b/drivers/acpi/acpi_apd.c
@@ -42,6 +42,7 @@  struct apd_private_data;
 struct apd_device_desc {
 	unsigned int flags;
 	unsigned int fixed_clk_rate;
+	struct property_entry *properties;
 	int (*setup)(struct apd_private_data *pdata);
 };
 
@@ -67,6 +68,9 @@  static int acpi_apd_setup(struct apd_private_data *pdata)
 		pdata->clk = clk;
 	}
 
+	if (pdata->properties)
+		return device_add_properties(&pdata->adev->dev,
+					     pdata->properties);
 	return 0;
 }
 
@@ -76,9 +80,17 @@  static struct apd_device_desc cz_i2c_desc = {
 	.fixed_clk_rate = 133000000,
 };
 
+static struct property_entry uart_properties[] = {
+	PROPERTY_ENTRY_U32("reg-io-width", 4),
+	PROPERTY_ENTRY_U32("reg-shift", 2),
+	PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
+	{ },
+};
+
 static struct apd_device_desc cz_uart_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 48000000,
+	.properties = uart_properties,
 };
 #endif