aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-06 16:07:33 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-06 16:07:33 -0400
commitdab2e29402f40431d2199e6faff48174204d2d06 (patch)
treec1e17dec728f4badd623d24c77679f219af247dd
parent0224a4a30b57385a60065aa598181868881d8fc6 (diff)
parentf4d05266032346531b9f889e26aa31a0cf2a9822 (diff)
Merge back new device properties material for v4.7.
-rw-r--r--arch/arm/mach-pxa/raumfeld.c12
-rw-r--r--arch/arm/mach-tegra/board-paz00.c6
-rw-r--r--drivers/base/platform.c19
-rw-r--r--drivers/base/property.c34
-rw-r--r--drivers/mfd/intel-lpss-acpi.c12
-rw-r--r--drivers/mfd/intel-lpss-pci.c20
-rw-r--r--drivers/mfd/intel-lpss.c2
-rw-r--r--drivers/mfd/intel-lpss.h4
-rw-r--r--drivers/mfd/mfd-core.c4
-rw-r--r--include/linux/mfd/core.h4
-rw-r--r--include/linux/platform_device.h6
-rw-r--r--include/linux/property.h15
12 files changed, 55 insertions, 83 deletions
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 5a941bd3dbed..e216433b56ed 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -385,10 +385,6 @@ static struct property_entry raumfeld_rotary_properties[] = {
385 { }, 385 { },
386}; 386};
387 387
388static struct property_set raumfeld_rotary_property_set = {
389 .properties = raumfeld_rotary_properties,
390};
391
392static struct platform_device rotary_encoder_device = { 388static struct platform_device rotary_encoder_device = {
393 .name = "rotary-encoder", 389 .name = "rotary-encoder",
394 .id = 0, 390 .id = 0,
@@ -1063,8 +1059,8 @@ static void __init __maybe_unused raumfeld_controller_init(void)
1063 pxa3xx_mfp_config(ARRAY_AND_SIZE(raumfeld_controller_pin_config)); 1059 pxa3xx_mfp_config(ARRAY_AND_SIZE(raumfeld_controller_pin_config));
1064 1060
1065 gpiod_add_lookup_table(&raumfeld_rotary_gpios_table); 1061 gpiod_add_lookup_table(&raumfeld_rotary_gpios_table);
1066 device_add_property_set(&rotary_encoder_device.dev, 1062 device_add_properties(&rotary_encoder_device.dev,
1067 &raumfeld_rotary_property_set); 1063 raumfeld_rotary_properties);
1068 platform_device_register(&rotary_encoder_device); 1064 platform_device_register(&rotary_encoder_device);
1069 1065
1070 spi_register_board_info(ARRAY_AND_SIZE(controller_spi_devices)); 1066 spi_register_board_info(ARRAY_AND_SIZE(controller_spi_devices));
@@ -1103,8 +1099,8 @@ static void __init __maybe_unused raumfeld_speaker_init(void)
1103 platform_device_register(&smc91x_device); 1099 platform_device_register(&smc91x_device);
1104 1100
1105 gpiod_add_lookup_table(&raumfeld_rotary_gpios_table); 1101 gpiod_add_lookup_table(&raumfeld_rotary_gpios_table);
1106 device_add_property_set(&rotary_encoder_device.dev, 1102 device_add_properties(&rotary_encoder_device.dev,
1107 &raumfeld_rotary_property_set); 1103 raumfeld_rotary_properties);
1108 platform_device_register(&rotary_encoder_device); 1104 platform_device_register(&rotary_encoder_device);
1109 1105
1110 raumfeld_audio_init(); 1106 raumfeld_audio_init();
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 52db8bf7e153..7478f6fb3664 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -29,10 +29,6 @@ static struct property_entry __initdata wifi_rfkill_prop[] = {
29 { }, 29 { },
30}; 30};
31 31
32static struct property_set __initdata wifi_rfkill_pset = {
33 .properties = wifi_rfkill_prop,
34};
35
36static struct platform_device wifi_rfkill_device = { 32static struct platform_device wifi_rfkill_device = {
37 .name = "rfkill_gpio", 33 .name = "rfkill_gpio",
38 .id = -1, 34 .id = -1,
@@ -49,7 +45,7 @@ static struct gpiod_lookup_table wifi_gpio_lookup = {
49 45
50void __init tegra_paz00_wifikill_init(void) 46void __init tegra_paz00_wifikill_init(void)
51{ 47{
52 platform_device_add_properties(&wifi_rfkill_device, &wifi_rfkill_pset); 48 platform_device_add_properties(&wifi_rfkill_device, wifi_rfkill_prop);
53 gpiod_add_lookup_table(&wifi_gpio_lookup); 49 gpiod_add_lookup_table(&wifi_gpio_lookup);
54 platform_device_register(&wifi_rfkill_device); 50 platform_device_register(&wifi_rfkill_device);
55} 51}
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f437afa17f2b..6482d47deb50 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -322,16 +322,16 @@ EXPORT_SYMBOL_GPL(platform_device_add_data);
322/** 322/**
323 * platform_device_add_properties - add built-in properties to a platform device 323 * platform_device_add_properties - add built-in properties to a platform device
324 * @pdev: platform device to add properties to 324 * @pdev: platform device to add properties to
325 * @pset: properties to add 325 * @properties: null terminated array of properties to add
326 * 326 *
327 * The function will take deep copy of the properties in @pset and attach 327 * The function will take deep copy of @properties and attach the copy to the
328 * the copy to the platform device. The memory associated with properties 328 * platform device. The memory associated with properties will be freed when the
329 * will be freed when the platform device is released. 329 * platform device is released.
330 */ 330 */
331int platform_device_add_properties(struct platform_device *pdev, 331int platform_device_add_properties(struct platform_device *pdev,
332 const struct property_set *pset) 332 struct property_entry *properties)
333{ 333{
334 return device_add_property_set(&pdev->dev, pset); 334 return device_add_properties(&pdev->dev, properties);
335} 335}
336EXPORT_SYMBOL_GPL(platform_device_add_properties); 336EXPORT_SYMBOL_GPL(platform_device_add_properties);
337 337
@@ -447,7 +447,7 @@ void platform_device_del(struct platform_device *pdev)
447 release_resource(r); 447 release_resource(r);
448 } 448 }
449 449
450 device_remove_property_set(&pdev->dev); 450 device_remove_properties(&pdev->dev);
451 } 451 }
452} 452}
453EXPORT_SYMBOL_GPL(platform_device_del); 453EXPORT_SYMBOL_GPL(platform_device_del);
@@ -526,8 +526,9 @@ struct platform_device *platform_device_register_full(
526 if (ret) 526 if (ret)
527 goto err; 527 goto err;
528 528
529 if (pdevinfo->pset) { 529 if (pdevinfo->properties) {
530 ret = platform_device_add_properties(pdev, pdevinfo->pset); 530 ret = platform_device_add_properties(pdev,
531 pdevinfo->properties);
531 if (ret) 532 if (ret)
532 goto err; 533 goto err;
533 } 534 }
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 7f692accdc90..f38c21de29b7 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -19,6 +19,11 @@
19#include <linux/etherdevice.h> 19#include <linux/etherdevice.h>
20#include <linux/phy.h> 20#include <linux/phy.h>
21 21
22struct property_set {
23 struct fwnode_handle fwnode;
24 struct property_entry *properties;
25};
26
22static inline bool is_pset_node(struct fwnode_handle *fwnode) 27static inline bool is_pset_node(struct fwnode_handle *fwnode)
23{ 28{
24 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_PDATA; 29 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_PDATA;
@@ -801,14 +806,14 @@ static struct property_set *pset_copy_set(const struct property_set *pset)
801} 806}
802 807
803/** 808/**
804 * device_remove_property_set - Remove properties from a device object. 809 * device_remove_properties - Remove properties from a device object.
805 * @dev: Device whose properties to remove. 810 * @dev: Device whose properties to remove.
806 * 811 *
807 * The function removes properties previously associated to the device 812 * The function removes properties previously associated to the device
808 * secondary firmware node with device_add_property_set(). Memory allocated 813 * secondary firmware node with device_add_properties(). Memory allocated
809 * to the properties will also be released. 814 * to the properties will also be released.
810 */ 815 */
811void device_remove_property_set(struct device *dev) 816void device_remove_properties(struct device *dev)
812{ 817{
813 struct fwnode_handle *fwnode; 818 struct fwnode_handle *fwnode;
814 819
@@ -831,24 +836,27 @@ void device_remove_property_set(struct device *dev)
831 } 836 }
832 } 837 }
833} 838}
834EXPORT_SYMBOL_GPL(device_remove_property_set); 839EXPORT_SYMBOL_GPL(device_remove_properties);
835 840
836/** 841/**
837 * device_add_property_set - Add a collection of properties to a device object. 842 * device_add_properties - Add a collection of properties to a device object.
838 * @dev: Device to add properties to. 843 * @dev: Device to add properties to.
839 * @pset: Collection of properties to add. 844 * @properties: Collection of properties to add.
840 * 845 *
841 * Associate a collection of device properties represented by @pset with @dev 846 * Associate a collection of device properties represented by @properties with
842 * as its secondary firmware node. The function takes a copy of @pset. 847 * @dev as its secondary firmware node. The function takes a copy of
848 * @properties.
843 */ 849 */
844int device_add_property_set(struct device *dev, const struct property_set *pset) 850int device_add_properties(struct device *dev, struct property_entry *properties)
845{ 851{
846 struct property_set *p; 852 struct property_set *p, pset;
847 853
848 if (!pset) 854 if (!properties)
849 return -EINVAL; 855 return -EINVAL;
850 856
851 p = pset_copy_set(pset); 857 pset.properties = properties;
858
859 p = pset_copy_set(&pset);
852 if (IS_ERR(p)) 860 if (IS_ERR(p))
853 return PTR_ERR(p); 861 return PTR_ERR(p);
854 862
@@ -856,7 +864,7 @@ int device_add_property_set(struct device *dev, const struct property_set *pset)
856 set_secondary_fwnode(dev, &p->fwnode); 864 set_secondary_fwnode(dev, &p->fwnode);
857 return 0; 865 return 0;
858} 866}
859EXPORT_SYMBOL_GPL(device_add_property_set); 867EXPORT_SYMBOL_GPL(device_add_properties);
860 868
861/** 869/**
862 * device_get_next_child_node - Return the next child node handle for a device 870 * device_get_next_child_node - Return the next child node handle for a device
diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 5a8d9c766633..7ddc4a9563ea 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -31,13 +31,9 @@ static struct property_entry spt_i2c_properties[] = {
31 { }, 31 { },
32}; 32};
33 33
34static struct property_set spt_i2c_pset = {
35 .properties = spt_i2c_properties,
36};
37
38static const struct intel_lpss_platform_info spt_i2c_info = { 34static const struct intel_lpss_platform_info spt_i2c_info = {
39 .clk_rate = 120000000, 35 .clk_rate = 120000000,
40 .pset = &spt_i2c_pset, 36 .properties = spt_i2c_properties,
41}; 37};
42 38
43static const struct intel_lpss_platform_info bxt_info = { 39static const struct intel_lpss_platform_info bxt_info = {
@@ -51,13 +47,9 @@ static struct property_entry bxt_i2c_properties[] = {
51 { }, 47 { },
52}; 48};
53 49
54static struct property_set bxt_i2c_pset = {
55 .properties = bxt_i2c_properties,
56};
57
58static const struct intel_lpss_platform_info bxt_i2c_info = { 50static const struct intel_lpss_platform_info bxt_i2c_info = {
59 .clk_rate = 133000000, 51 .clk_rate = 133000000,
60 .pset = &bxt_i2c_pset, 52 .properties = bxt_i2c_properties,
61}; 53};
62 54
63static const struct acpi_device_id intel_lpss_acpi_ids[] = { 55static const struct acpi_device_id intel_lpss_acpi_ids[] = {
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index a19e57118641..1d79a3c9370f 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -71,13 +71,9 @@ static struct property_entry spt_i2c_properties[] = {
71 { }, 71 { },
72}; 72};
73 73
74static struct property_set spt_i2c_pset = {
75 .properties = spt_i2c_properties,
76};
77
78static const struct intel_lpss_platform_info spt_i2c_info = { 74static const struct intel_lpss_platform_info spt_i2c_info = {
79 .clk_rate = 120000000, 75 .clk_rate = 120000000,
80 .pset = &spt_i2c_pset, 76 .properties = spt_i2c_properties,
81}; 77};
82 78
83static struct property_entry uart_properties[] = { 79static struct property_entry uart_properties[] = {
@@ -87,14 +83,10 @@ static struct property_entry uart_properties[] = {
87 { }, 83 { },
88}; 84};
89 85
90static struct property_set uart_pset = {
91 .properties = uart_properties,
92};
93
94static const struct intel_lpss_platform_info spt_uart_info = { 86static const struct intel_lpss_platform_info spt_uart_info = {
95 .clk_rate = 120000000, 87 .clk_rate = 120000000,
96 .clk_con_id = "baudclk", 88 .clk_con_id = "baudclk",
97 .pset = &uart_pset, 89 .properties = uart_properties,
98}; 90};
99 91
100static const struct intel_lpss_platform_info bxt_info = { 92static const struct intel_lpss_platform_info bxt_info = {
@@ -104,7 +96,7 @@ static const struct intel_lpss_platform_info bxt_info = {
104static const struct intel_lpss_platform_info bxt_uart_info = { 96static const struct intel_lpss_platform_info bxt_uart_info = {
105 .clk_rate = 100000000, 97 .clk_rate = 100000000,
106 .clk_con_id = "baudclk", 98 .clk_con_id = "baudclk",
107 .pset = &uart_pset, 99 .properties = uart_properties,
108}; 100};
109 101
110static struct property_entry bxt_i2c_properties[] = { 102static struct property_entry bxt_i2c_properties[] = {
@@ -114,13 +106,9 @@ static struct property_entry bxt_i2c_properties[] = {
114 { }, 106 { },
115}; 107};
116 108
117static struct property_set bxt_i2c_pset = {
118 .properties = bxt_i2c_properties,
119};
120
121static const struct intel_lpss_platform_info bxt_i2c_info = { 109static const struct intel_lpss_platform_info bxt_i2c_info = {
122 .clk_rate = 133000000, 110 .clk_rate = 133000000,
123 .pset = &bxt_i2c_pset, 111 .properties = bxt_i2c_properties,
124}; 112};
125 113
126static const struct pci_device_id intel_lpss_pci_ids[] = { 114static const struct pci_device_id intel_lpss_pci_ids[] = {
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 1bbbe877ba7e..6352aaba96a4 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -407,7 +407,7 @@ int intel_lpss_probe(struct device *dev,
407 if (ret) 407 if (ret)
408 return ret; 408 return ret;
409 409
410 lpss->cell->pset = info->pset; 410 lpss->cell->properties = info->properties;
411 411
412 intel_lpss_init_dev(lpss); 412 intel_lpss_init_dev(lpss);
413 413
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h
index 0dcea9eb2d03..694116630ffa 100644
--- a/drivers/mfd/intel-lpss.h
+++ b/drivers/mfd/intel-lpss.h
@@ -16,14 +16,14 @@
16 16
17struct device; 17struct device;
18struct resource; 18struct resource;
19struct property_set; 19struct property_entry;
20 20
21struct intel_lpss_platform_info { 21struct intel_lpss_platform_info {
22 struct resource *mem; 22 struct resource *mem;
23 int irq; 23 int irq;
24 unsigned long clk_rate; 24 unsigned long clk_rate;
25 const char *clk_con_id; 25 const char *clk_con_id;
26 struct property_set *pset; 26 struct property_entry *properties;
27}; 27};
28 28
29int intel_lpss_probe(struct device *dev, 29int intel_lpss_probe(struct device *dev,
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 88bd1b1e47be..fc1c1fc13813 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -193,8 +193,8 @@ static int mfd_add_device(struct device *parent, int id,
193 goto fail_alias; 193 goto fail_alias;
194 } 194 }
195 195
196 if (cell->pset) { 196 if (cell->properties) {
197 ret = platform_device_add_properties(pdev, cell->pset); 197 ret = platform_device_add_properties(pdev, cell->properties);
198 if (ret) 198 if (ret)
199 goto fail_alias; 199 goto fail_alias;
200 } 200 }
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index bc6f7e00fb3d..9837f1e8c94c 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -17,7 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18 18
19struct irq_domain; 19struct irq_domain;
20struct property_set; 20struct property_entry;
21 21
22/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */ 22/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
23struct mfd_cell_acpi_match { 23struct mfd_cell_acpi_match {
@@ -47,7 +47,7 @@ struct mfd_cell {
47 size_t pdata_size; 47 size_t pdata_size;
48 48
49 /* device properties passed to the sub devices drivers */ 49 /* device properties passed to the sub devices drivers */
50 const struct property_set *pset; 50 struct property_entry *properties;
51 51
52 /* 52 /*
53 * Device Tree compatible string 53 * Device Tree compatible string
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 03b755521fd9..98c2a7c7108e 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -18,7 +18,7 @@
18#define PLATFORM_DEVID_AUTO (-2) 18#define PLATFORM_DEVID_AUTO (-2)
19 19
20struct mfd_cell; 20struct mfd_cell;
21struct property_set; 21struct property_entry;
22 22
23struct platform_device { 23struct platform_device {
24 const char *name; 24 const char *name;
@@ -73,7 +73,7 @@ struct platform_device_info {
73 size_t size_data; 73 size_t size_data;
74 u64 dma_mask; 74 u64 dma_mask;
75 75
76 const struct property_set *pset; 76 struct property_entry *properties;
77}; 77};
78extern struct platform_device *platform_device_register_full( 78extern struct platform_device *platform_device_register_full(
79 const struct platform_device_info *pdevinfo); 79 const struct platform_device_info *pdevinfo);
@@ -172,7 +172,7 @@ extern int platform_device_add_resources(struct platform_device *pdev,
172extern int platform_device_add_data(struct platform_device *pdev, 172extern int platform_device_add_data(struct platform_device *pdev,
173 const void *data, size_t size); 173 const void *data, size_t size);
174extern int platform_device_add_properties(struct platform_device *pdev, 174extern int platform_device_add_properties(struct platform_device *pdev,
175 const struct property_set *pset); 175 struct property_entry *properties);
176extern int platform_device_add(struct platform_device *pdev); 176extern int platform_device_add(struct platform_device *pdev);
177extern void platform_device_del(struct platform_device *pdev); 177extern void platform_device_del(struct platform_device *pdev);
178extern void platform_device_put(struct platform_device *pdev); 178extern void platform_device_put(struct platform_device *pdev);
diff --git a/include/linux/property.h b/include/linux/property.h
index b51fcd36d892..ecab11e40794 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -238,18 +238,9 @@ struct property_entry {
238 .name = _name_, \ 238 .name = _name_, \
239} 239}
240 240
241/** 241int device_add_properties(struct device *dev,
242 * struct property_set - Collection of "built-in" device properties. 242 struct property_entry *properties);
243 * @fwnode: Handle to be pointed to by the fwnode field of struct device. 243void device_remove_properties(struct device *dev);
244 * @properties: Array of properties terminated with a null entry.
245 */
246struct property_set {
247 struct fwnode_handle fwnode;
248 struct property_entry *properties;
249};
250
251int device_add_property_set(struct device *dev, const struct property_set *pset);
252void device_remove_property_set(struct device *dev);
253 244
254bool device_dma_supported(struct device *dev); 245bool device_dma_supported(struct device *dev);
255 246