Skip to content

Commit 1649098

Browse files
committed
Merge tag 'device-properties-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties update from Rafael Wysocki: "Generic device properties framework update. Just one commit reworking the handling of built-in properties initialization and updating a few drivers in accordance with the core framework changes" * tag 'device-properties-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: device property: don't bother the drivers with struct property_set
2 parents 46c1345 + dab2e29 commit 1649098

File tree

12 files changed

+55
-83
lines changed

12 files changed

+55
-83
lines changed

arch/arm/mach-pxa/raumfeld.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,6 @@ static struct property_entry raumfeld_rotary_properties[] = {
385385
{ },
386386
};
387387

388-
static struct property_set raumfeld_rotary_property_set = {
389-
.properties = raumfeld_rotary_properties,
390-
};
391-
392388
static struct platform_device rotary_encoder_device = {
393389
.name = "rotary-encoder",
394390
.id = 0,
@@ -1063,8 +1059,8 @@ static void __init __maybe_unused raumfeld_controller_init(void)
10631059
pxa3xx_mfp_config(ARRAY_AND_SIZE(raumfeld_controller_pin_config));
10641060

10651061
gpiod_add_lookup_table(&raumfeld_rotary_gpios_table);
1066-
device_add_property_set(&rotary_encoder_device.dev,
1067-
&raumfeld_rotary_property_set);
1062+
device_add_properties(&rotary_encoder_device.dev,
1063+
raumfeld_rotary_properties);
10681064
platform_device_register(&rotary_encoder_device);
10691065

10701066
spi_register_board_info(ARRAY_AND_SIZE(controller_spi_devices));
@@ -1103,8 +1099,8 @@ static void __init __maybe_unused raumfeld_speaker_init(void)
11031099
platform_device_register(&smc91x_device);
11041100

11051101
gpiod_add_lookup_table(&raumfeld_rotary_gpios_table);
1106-
device_add_property_set(&rotary_encoder_device.dev,
1107-
&raumfeld_rotary_property_set);
1102+
device_add_properties(&rotary_encoder_device.dev,
1103+
raumfeld_rotary_properties);
11081104
platform_device_register(&rotary_encoder_device);
11091105

11101106
raumfeld_audio_init();

arch/arm/mach-tegra/board-paz00.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ static struct property_entry __initdata wifi_rfkill_prop[] = {
2929
{ },
3030
};
3131

32-
static struct property_set __initdata wifi_rfkill_pset = {
33-
.properties = wifi_rfkill_prop,
34-
};
35-
3632
static struct platform_device wifi_rfkill_device = {
3733
.name = "rfkill_gpio",
3834
.id = -1,
@@ -49,7 +45,7 @@ static struct gpiod_lookup_table wifi_gpio_lookup = {
4945

5046
void __init tegra_paz00_wifikill_init(void)
5147
{
52-
platform_device_add_properties(&wifi_rfkill_device, &wifi_rfkill_pset);
48+
platform_device_add_properties(&wifi_rfkill_device, wifi_rfkill_prop);
5349
gpiod_add_lookup_table(&wifi_gpio_lookup);
5450
platform_device_register(&wifi_rfkill_device);
5551
}

drivers/base/platform.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,16 @@ EXPORT_SYMBOL_GPL(platform_device_add_data);
322322
/**
323323
* platform_device_add_properties - add built-in properties to a platform device
324324
* @pdev: platform device to add properties to
325-
* @pset: properties to add
325+
* @properties: null terminated array of properties to add
326326
*
327-
* The function will take deep copy of the properties in @pset and attach
328-
* the copy to the platform device. The memory associated with properties
329-
* will be freed when the platform device is released.
327+
* The function will take deep copy of @properties and attach the copy to the
328+
* platform device. The memory associated with properties will be freed when the
329+
* platform device is released.
330330
*/
331331
int platform_device_add_properties(struct platform_device *pdev,
332-
const struct property_set *pset)
332+
struct property_entry *properties)
333333
{
334-
return device_add_property_set(&pdev->dev, pset);
334+
return device_add_properties(&pdev->dev, properties);
335335
}
336336
EXPORT_SYMBOL_GPL(platform_device_add_properties);
337337

@@ -447,7 +447,7 @@ void platform_device_del(struct platform_device *pdev)
447447
release_resource(r);
448448
}
449449

450-
device_remove_property_set(&pdev->dev);
450+
device_remove_properties(&pdev->dev);
451451
}
452452
}
453453
EXPORT_SYMBOL_GPL(platform_device_del);
@@ -526,8 +526,9 @@ struct platform_device *platform_device_register_full(
526526
if (ret)
527527
goto err;
528528

529-
if (pdevinfo->pset) {
530-
ret = platform_device_add_properties(pdev, pdevinfo->pset);
529+
if (pdevinfo->properties) {
530+
ret = platform_device_add_properties(pdev,
531+
pdevinfo->properties);
531532
if (ret)
532533
goto err;
533534
}

drivers/base/property.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
#include <linux/etherdevice.h>
2020
#include <linux/phy.h>
2121

22+
struct property_set {
23+
struct fwnode_handle fwnode;
24+
struct property_entry *properties;
25+
};
26+
2227
static inline bool is_pset_node(struct fwnode_handle *fwnode)
2328
{
2429
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)
801806
}
802807

803808
/**
804-
* device_remove_property_set - Remove properties from a device object.
809+
* device_remove_properties - Remove properties from a device object.
805810
* @dev: Device whose properties to remove.
806811
*
807812
* 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
809814
* to the properties will also be released.
810815
*/
811-
void device_remove_property_set(struct device *dev)
816+
void device_remove_properties(struct device *dev)
812817
{
813818
struct fwnode_handle *fwnode;
814819

@@ -831,32 +836,35 @@ void device_remove_property_set(struct device *dev)
831836
}
832837
}
833838
}
834-
EXPORT_SYMBOL_GPL(device_remove_property_set);
839+
EXPORT_SYMBOL_GPL(device_remove_properties);
835840

836841
/**
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.
838843
* @dev: Device to add properties to.
839-
* @pset: Collection of properties to add.
844+
* @properties: Collection of properties to add.
840845
*
841-
* Associate a collection of device properties represented by @pset with @dev
842-
* as its secondary firmware node. The function takes a copy of @pset.
846+
* Associate a collection of device properties represented by @properties with
847+
* @dev as its secondary firmware node. The function takes a copy of
848+
* @properties.
843849
*/
844-
int device_add_property_set(struct device *dev, const struct property_set *pset)
850+
int device_add_properties(struct device *dev, struct property_entry *properties)
845851
{
846-
struct property_set *p;
852+
struct property_set *p, pset;
847853

848-
if (!pset)
854+
if (!properties)
849855
return -EINVAL;
850856

851-
p = pset_copy_set(pset);
857+
pset.properties = properties;
858+
859+
p = pset_copy_set(&pset);
852860
if (IS_ERR(p))
853861
return PTR_ERR(p);
854862

855863
p->fwnode.type = FWNODE_PDATA;
856864
set_secondary_fwnode(dev, &p->fwnode);
857865
return 0;
858866
}
859-
EXPORT_SYMBOL_GPL(device_add_property_set);
867+
EXPORT_SYMBOL_GPL(device_add_properties);
860868

861869
/**
862870
* device_get_next_child_node - Return the next child node handle for a device

drivers/mfd/intel-lpss-acpi.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,9 @@ static struct property_entry spt_i2c_properties[] = {
3131
{ },
3232
};
3333

34-
static struct property_set spt_i2c_pset = {
35-
.properties = spt_i2c_properties,
36-
};
37-
3834
static const struct intel_lpss_platform_info spt_i2c_info = {
3935
.clk_rate = 120000000,
40-
.pset = &spt_i2c_pset,
36+
.properties = spt_i2c_properties,
4137
};
4238

4339
static const struct intel_lpss_platform_info bxt_info = {
@@ -51,13 +47,9 @@ static struct property_entry bxt_i2c_properties[] = {
5147
{ },
5248
};
5349

54-
static struct property_set bxt_i2c_pset = {
55-
.properties = bxt_i2c_properties,
56-
};
57-
5850
static const struct intel_lpss_platform_info bxt_i2c_info = {
5951
.clk_rate = 133000000,
60-
.pset = &bxt_i2c_pset,
52+
.properties = bxt_i2c_properties,
6153
};
6254

6355
static const struct acpi_device_id intel_lpss_acpi_ids[] = {

drivers/mfd/intel-lpss-pci.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,9 @@ static struct property_entry spt_i2c_properties[] = {
7171
{ },
7272
};
7373

74-
static struct property_set spt_i2c_pset = {
75-
.properties = spt_i2c_properties,
76-
};
77-
7874
static const struct intel_lpss_platform_info spt_i2c_info = {
7975
.clk_rate = 120000000,
80-
.pset = &spt_i2c_pset,
76+
.properties = spt_i2c_properties,
8177
};
8278

8379
static struct property_entry uart_properties[] = {
@@ -87,14 +83,10 @@ static struct property_entry uart_properties[] = {
8783
{ },
8884
};
8985

90-
static struct property_set uart_pset = {
91-
.properties = uart_properties,
92-
};
93-
9486
static const struct intel_lpss_platform_info spt_uart_info = {
9587
.clk_rate = 120000000,
9688
.clk_con_id = "baudclk",
97-
.pset = &uart_pset,
89+
.properties = uart_properties,
9890
};
9991

10092
static const struct intel_lpss_platform_info bxt_info = {
@@ -104,7 +96,7 @@ static const struct intel_lpss_platform_info bxt_info = {
10496
static const struct intel_lpss_platform_info bxt_uart_info = {
10597
.clk_rate = 100000000,
10698
.clk_con_id = "baudclk",
107-
.pset = &uart_pset,
99+
.properties = uart_properties,
108100
};
109101

110102
static struct property_entry bxt_i2c_properties[] = {
@@ -114,13 +106,9 @@ static struct property_entry bxt_i2c_properties[] = {
114106
{ },
115107
};
116108

117-
static struct property_set bxt_i2c_pset = {
118-
.properties = bxt_i2c_properties,
119-
};
120-
121109
static const struct intel_lpss_platform_info bxt_i2c_info = {
122110
.clk_rate = 133000000,
123-
.pset = &bxt_i2c_pset,
111+
.properties = bxt_i2c_properties,
124112
};
125113

126114
static const struct pci_device_id intel_lpss_pci_ids[] = {

drivers/mfd/intel-lpss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ int intel_lpss_probe(struct device *dev,
407407
if (ret)
408408
return ret;
409409

410-
lpss->cell->pset = info->pset;
410+
lpss->cell->properties = info->properties;
411411

412412
intel_lpss_init_dev(lpss);
413413

drivers/mfd/intel-lpss.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
struct device;
1818
struct resource;
19-
struct property_set;
19+
struct property_entry;
2020

2121
struct intel_lpss_platform_info {
2222
struct resource *mem;
2323
int irq;
2424
unsigned long clk_rate;
2525
const char *clk_con_id;
26-
struct property_set *pset;
26+
struct property_entry *properties;
2727
};
2828

2929
int intel_lpss_probe(struct device *dev,

drivers/mfd/mfd-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ static int mfd_add_device(struct device *parent, int id,
193193
goto fail_alias;
194194
}
195195

196-
if (cell->pset) {
197-
ret = platform_device_add_properties(pdev, cell->pset);
196+
if (cell->properties) {
197+
ret = platform_device_add_properties(pdev, cell->properties);
198198
if (ret)
199199
goto fail_alias;
200200
}

include/linux/mfd/core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <linux/platform_device.h>
1818

1919
struct irq_domain;
20-
struct property_set;
20+
struct property_entry;
2121

2222
/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
2323
struct mfd_cell_acpi_match {
@@ -47,7 +47,7 @@ struct mfd_cell {
4747
size_t pdata_size;
4848

4949
/* device properties passed to the sub devices drivers */
50-
const struct property_set *pset;
50+
struct property_entry *properties;
5151

5252
/*
5353
* Device Tree compatible string

include/linux/platform_device.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define PLATFORM_DEVID_AUTO (-2)
1919

2020
struct mfd_cell;
21-
struct property_set;
21+
struct property_entry;
2222

2323
struct platform_device {
2424
const char *name;
@@ -73,7 +73,7 @@ struct platform_device_info {
7373
size_t size_data;
7474
u64 dma_mask;
7575

76-
const struct property_set *pset;
76+
struct property_entry *properties;
7777
};
7878
extern struct platform_device *platform_device_register_full(
7979
const struct platform_device_info *pdevinfo);
@@ -172,7 +172,7 @@ extern int platform_device_add_resources(struct platform_device *pdev,
172172
extern int platform_device_add_data(struct platform_device *pdev,
173173
const void *data, size_t size);
174174
extern int platform_device_add_properties(struct platform_device *pdev,
175-
const struct property_set *pset);
175+
struct property_entry *properties);
176176
extern int platform_device_add(struct platform_device *pdev);
177177
extern void platform_device_del(struct platform_device *pdev);
178178
extern void platform_device_put(struct platform_device *pdev);

include/linux/property.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,9 @@ struct property_entry {
238238
.name = _name_, \
239239
}
240240

241-
/**
242-
* struct property_set - Collection of "built-in" device properties.
243-
* @fwnode: Handle to be pointed to by the fwnode field of struct device.
244-
* @properties: Array of properties terminated with a null entry.
245-
*/
246-
struct property_set {
247-
struct fwnode_handle fwnode;
248-
struct property_entry *properties;
249-
};
250-
251-
int device_add_property_set(struct device *dev, const struct property_set *pset);
252-
void device_remove_property_set(struct device *dev);
241+
int device_add_properties(struct device *dev,
242+
struct property_entry *properties);
243+
void device_remove_properties(struct device *dev);
253244

254245
bool device_dma_supported(struct device *dev);
255246

0 commit comments

Comments
 (0)