mfd: core: Add support for software nodes
Andy Shevchenko
reviewerPATCH 1/4 mfd: core: Add support for software nodes
From: Heikki Krogerus <[email protected]>
The old device property API is going to be removed and replaced with the newer software node API. This prepares MFD subsystem for the transition.
--- drivers/mfd/mfd-core.c | 9 +++++++++ include/linux/mfd/core.h | 4 ++++ 2 files changed, 13 insertions(+)
drivers/mfd/mfd-core.c +9 -0
@@ -244,6 +244,12 @@ static int mfd_add_device(struct device *parent, int id, goto fail_of_entry; } +if (cell->swnode) { + ret =device_add_software_node (&pdev->dev, cell->swnode); +if (ret) + goto fail_of_entry; + } +for (r =0 ; r < cell->num_resources; r++) { res[r].name = cell->resources[r].name; res[r].flags = cell->resources[r].flags;
@@ -304,6 +310,7 @@ static int mfd_add_device(struct device *parent, int id,list_del (&of_entry->list);kfree (of_entry); } +device_remove_software_node (&pdev->dev); fail_alias: regulator_bulk_unregister_supply_alias(&pdev->dev, cell->parent_supplies,
@@ -372,6 +379,8 @@ static int mfd_remove_devices_fn(struct device *dev, void *data)regulator_bulk_unregister_supply_alias (dev, cell->parent_supplies, cell->num_parent_supplies); +device_remove_software_node (&pdev->dev); +platform_device_unregister (pdev);return 0 ; }
include/linux/mfd/core.h +4 -0
@@ -50,6 +50,7 @@#define MFD_DEP_LEVEL_HIGH 1struct irq_domain ; +struct software_node ;struct property_entry ;/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
@@ -78,6 +79,9 @@ struct mfd_cell {void *platform_data;size_t pdata_size; +/* Software node for the device. */ +const struct software_node *swnode; +/* device properties passed to the sub devices drivers */ const struct property_entry *properties;
Signature · 1 line
2.30.1
Andy Shevchenko
reviewerPATCH 2/4 mfd: intel-lpss: Constify device property structures
There is no point to have non-constant device properties in this driver. Thus, constify them for good.
--- drivers/mfd/intel-lpss-acpi.c | 8 ++++---- drivers/mfd/intel-lpss-pci.c | 10 +++++----- drivers/mfd/intel-lpss.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/mfd/intel-lpss-acpi.c +4 -4
@@ -22,7 +22,7 @@ static const struct intel_lpss_platform_info spt_info = { .clk_rate = 120000000, }; -static struct property_entry spt_i2c_properties[] = { +static const struct property_entry spt_i2c_properties[] = {PROPERTY_ENTRY_U32 ("i2c-sda-hold-time-ns" ,230 ), { }, };
@@ -32,7 +32,7 @@ static const struct intel_lpss_platform_info spt_i2c_info = { .properties = spt_i2c_properties, }; -static struct property_entry uart_properties[] = { +static const 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" ),
@@ -49,7 +49,7 @@ static const struct intel_lpss_platform_info bxt_info = { .clk_rate = 100000000, }; -static struct property_entry bxt_i2c_properties[] = { +static const struct property_entry bxt_i2c_properties[] = {PROPERTY_ENTRY_U32 ("i2c-sda-hold-time-ns" ,42 ),PROPERTY_ENTRY_U32 ("i2c-sda-falling-time-ns" ,171 ),PROPERTY_ENTRY_U32 ("i2c-scl-falling-time-ns" ,208 ),
@@ -61,7 +61,7 @@ static const struct intel_lpss_platform_info bxt_i2c_info = { .properties = bxt_i2c_properties, }; -static struct property_entry apl_i2c_properties[] = { +static const struct property_entry apl_i2c_properties[] = {PROPERTY_ENTRY_U32 ("i2c-sda-hold-time-ns" ,207 ),PROPERTY_ENTRY_U32 ("i2c-sda-falling-time-ns" ,171 ),PROPERTY_ENTRY_U32 ("i2c-scl-falling-time-ns" ,208 ),
drivers/mfd/intel-lpss-pci.c +5 -5
@@ -65,7 +65,7 @@ static const struct intel_lpss_platform_info spt_info = { .clk_rate = 120000000, }; -static struct property_entry spt_i2c_properties[] = { +static const struct property_entry spt_i2c_properties[] = {PROPERTY_ENTRY_U32 ("i2c-sda-hold-time-ns" ,230 ), { }, };
@@ -75,7 +75,7 @@ static const struct intel_lpss_platform_info spt_i2c_info = { .properties = spt_i2c_properties, }; -static struct property_entry uart_properties[] = { +static const 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" ),
@@ -98,7 +98,7 @@ static const struct intel_lpss_platform_info bxt_uart_info = { .properties = uart_properties, }; -static struct property_entry bxt_i2c_properties[] = { +static const struct property_entry bxt_i2c_properties[] = {PROPERTY_ENTRY_U32 ("i2c-sda-hold-time-ns" ,42 ),PROPERTY_ENTRY_U32 ("i2c-sda-falling-time-ns" ,171 ),PROPERTY_ENTRY_U32 ("i2c-scl-falling-time-ns" ,208 ),
@@ -110,7 +110,7 @@ static const struct intel_lpss_platform_info bxt_i2c_info = { .properties = bxt_i2c_properties, }; -static struct property_entry apl_i2c_properties[] = { +static const struct property_entry apl_i2c_properties[] = {PROPERTY_ENTRY_U32 ("i2c-sda-hold-time-ns" ,207 ),PROPERTY_ENTRY_U32 ("i2c-sda-falling-time-ns" ,171 ),PROPERTY_ENTRY_U32 ("i2c-scl-falling-time-ns" ,208 ),
@@ -122,7 +122,7 @@ static const struct intel_lpss_platform_info apl_i2c_info = { .properties = apl_i2c_properties, }; -static struct property_entry glk_i2c_properties[] = { +static const struct property_entry glk_i2c_properties[] = {PROPERTY_ENTRY_U32 ("i2c-sda-hold-time-ns" ,313 ),PROPERTY_ENTRY_U32 ("i2c-sda-falling-time-ns" ,171 ),PROPERTY_ENTRY_U32 ("i2c-scl-falling-time-ns" ,290 ),
drivers/mfd/intel-lpss.h +1 -1
@@ -22,7 +22,7 @@ struct intel_lpss_platform_info {int irq;unsigned long clk_rate;const char *clk_con_id; -struct property_entry *properties; +const struct property_entry *properties; }; int intel_lpss_probe(struct device *dev,
Signature · 1 line
2.30.1
Lee Jones
AppliedRe: [PATCH v1 2/4] mfd: intel-lpss: Constify device property structures
Quoted 9 lines · Andy Shevchenko
There is no point to have non-constant device properties in this driver. Thus, constify them for good.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel-lpss-acpi.c | 8 ++++---- drivers/mfd/intel-lpss-pci.c | 10 +++++----- drivers/mfd/intel-lpss.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Andy Shevchenko
reviewerPATCH 3/4 mfd: intel-lpss: Switch to use the software nodes
In reply to Andy ShevchenkoFrom: Heikki Krogerus <[email protected]>
Software node was always created for the device if it was supplied with additional device properties, so those nodes might as well be constant.
--- drivers/mfd/intel-lpss-acpi.c | 24 +++++++++++++++++++---- drivers/mfd/intel-lpss-pci.c | 36 +++++++++++++++++++++++++++-------- drivers/mfd/intel-lpss.c | 2 +- drivers/mfd/intel-lpss.h | 4 ++-- 4 files changed, 51 insertions(+), 15 deletions(-)
drivers/mfd/intel-lpss-acpi.c +20 -4
@@ -27,9 +27,13 @@ static const struct property_entry spt_i2c_properties[] = { { }, }; +static const struct software_node spt_i2c_node = { + .properties = spt_i2c_properties, +}; +static const struct intel_lpss_platform_info spt_i2c_info = { .clk_rate =120000000 , - .properties = spt_i2c_properties, + .swnode = &spt_i2c_node, };static const struct property_entry uart_properties[] = {
@@ -39,10 +43,14 @@ static const struct property_entry uart_properties[] = { { }, }; +static const struct software_node uart_node = { + .properties = uart_properties, +}; +static const struct intel_lpss_platform_info spt_uart_info = { .clk_rate =120000000 , .clk_con_id ="baudclk" , - .properties = uart_properties, + .swnode = &uart_node, };static const struct intel_lpss_platform_info bxt_info = {
@@ -56,9 +64,13 @@ static const struct property_entry bxt_i2c_properties[] = { { }, }; +static const struct software_node bxt_i2c_node = { + .properties = bxt_i2c_properties, +}; +static const struct intel_lpss_platform_info bxt_i2c_info = { .clk_rate =133000000 , - .properties = bxt_i2c_properties, + .swnode = &bxt_i2c_node, };static const struct property_entry apl_i2c_properties[] = {
@@ -68,9 +80,13 @@ static const struct property_entry apl_i2c_properties[] = { { }, }; +static const struct software_node apl_i2c_node = { + .properties = apl_i2c_properties, +}; +static const struct intel_lpss_platform_info apl_i2c_info = { .clk_rate =133000000 , - .properties = apl_i2c_properties, + .swnode = &apl_i2c_node, };static const struct acpi_device_id intel_lpss_acpi_ids[] = {
drivers/mfd/intel-lpss-pci.c +28 -8
@@ -70,9 +70,13 @@ static const struct property_entry spt_i2c_properties[] = { { }, }; +static const struct software_node spt_i2c_node = { + .properties = spt_i2c_properties, +}; +static const struct intel_lpss_platform_info spt_i2c_info = { .clk_rate =120000000 , - .properties = spt_i2c_properties, + .swnode = &spt_i2c_node, };static const struct property_entry uart_properties[] = {
@@ -82,10 +86,14 @@ static const struct property_entry uart_properties[] = { { }, }; +static const struct software_node uart_node = { + .properties = uart_properties, +}; +static const struct intel_lpss_platform_info spt_uart_info = { .clk_rate =120000000 , .clk_con_id ="baudclk" , - .properties = uart_properties, + .swnode = &uart_node, };static const struct intel_lpss_platform_info bxt_info = {
@@ -95,7 +103,7 @@ static const struct intel_lpss_platform_info bxt_info = {static const struct intel_lpss_platform_info bxt_uart_info = { .clk_rate =100000000 , .clk_con_id ="baudclk" , - .properties = uart_properties, + .swnode = &uart_node, };static const struct property_entry bxt_i2c_properties[] = {
@@ -105,9 +113,13 @@ static const struct property_entry bxt_i2c_properties[] = { { }, }; +static const struct software_node bxt_i2c_node = { + .properties = bxt_i2c_properties, +}; +static const struct intel_lpss_platform_info bxt_i2c_info = { .clk_rate =133000000 , - .properties = bxt_i2c_properties, + .swnode = &bxt_i2c_node, };static const struct property_entry apl_i2c_properties[] = {
@@ -117,9 +129,13 @@ static const struct property_entry apl_i2c_properties[] = { { }, }; +static const struct software_node apl_i2c_node = { + .properties = apl_i2c_properties, +}; +static const struct intel_lpss_platform_info apl_i2c_info = { .clk_rate =133000000 , - .properties = apl_i2c_properties, + .swnode = &apl_i2c_node, };static const struct property_entry glk_i2c_properties[] = {
@@ -129,19 +145,23 @@ static const struct property_entry glk_i2c_properties[] = { { }, }; +static const struct software_node glk_i2c_node = { + .properties = glk_i2c_properties, +}; +static const struct intel_lpss_platform_info glk_i2c_info = { .clk_rate =133000000 , - .properties = glk_i2c_properties, + .swnode = &glk_i2c_node, };static const struct intel_lpss_platform_info cnl_i2c_info = { .clk_rate =216000000 , - .properties = spt_i2c_properties, + .swnode = &spt_i2c_node, };static const struct intel_lpss_platform_info ehl_i2c_info = { .clk_rate =100000000 , - .properties = bxt_i2c_properties, + .swnode = &bxt_i2c_node, };static const struct pci_device_id intel_lpss_pci_ids[] = {
drivers/mfd/intel-lpss.c +1 -1
@@ -399,7 +399,7 @@ int intel_lpss_probe(struct device *dev,if (ret)return ret; - lpss->cell->properties = info->properties; + lpss->cell->swnode = info->swnode;intel_lpss_init_dev (lpss);
drivers/mfd/intel-lpss.h +2 -2
@@ -15,14 +15,14 @@struct device ;struct resource ; -struct property_entry ; +struct software_node ;struct intel_lpss_platform_info {struct resource *mem;int irq;unsigned long clk_rate;const char *clk_con_id; -const struct property_entry *properties; +const struct software_node *swnode; }; int intel_lpss_probe(struct device *dev,
Signature · 1 line
2.30.1
Lee Jones
AppliedRe: [PATCH v1 3/4] mfd: intel-lpss: Switch to use the software nodes
Quoted 6 lines · Andy Shevchenko
From: Heikki Krogerus <[email protected]>
Software node was always created for the device if it was supplied with additional device properties, so those nodes might as well be constant.
Quoted 8 lines
Signed-off-by Heikki Krogerus <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel-lpss-acpi.c | 24 +++++++++++++++++++---- drivers/mfd/intel-lpss-pci.c | 36 +++++++++++++++++++++++++++-------- drivers/mfd/intel-lpss.c | 2 +- drivers/mfd/intel-lpss.h | 4 ++-- 4 files changed, 51 insertions(+), 15 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Andy Shevchenko
reviewerPATCH 4/4 mfd: core: Remove support for dangling device properties
In reply to Andy ShevchenkoFrom: Heikki Krogerus <[email protected]>
From now on only accepting complete software nodes.
--- drivers/mfd/mfd-core.c | 6 ------ include/linux/mfd/core.h | 4 ---- 2 files changed, 10 deletions(-)
drivers/mfd/mfd-core.c +0 -6
@@ -238,12 +238,6 @@ static int mfd_add_device(struct device *parent, int id, goto fail_of_entry; } -if (cell->properties) { - ret =platform_device_add_properties (pdev, cell->properties); -if (ret) - goto fail_of_entry; - } -if (cell->swnode) { ret =device_add_software_node (&pdev->dev, cell->swnode);if (ret)
include/linux/mfd/core.h +0 -4
@@ -51,7 +51,6 @@struct irq_domain ;struct software_node ; -struct property_entry ;/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */ struct mfd_cell_acpi_match {
@@ -82,9 +81,6 @@ struct mfd_cell {/* Software node for the device. */ const struct software_node *swnode; -/* device properties passed to the sub devices drivers */ -const struct property_entry *properties; -/* * Device Tree compatible string * See: Documentation/devicetree/usage-model.rst Chapter 2.2 for details
Signature · 1 line
2.30.1
Lee Jones
AppliedRe: [PATCH v1 4/4] mfd: core: Remove support for dangling device properties
Quoted 10 lines · Andy Shevchenko
From: Heikki Krogerus <[email protected]>
From now on only accepting complete software nodes.
Signed-off-by Heikki Krogerus <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/mfd-core.c | 6 ------ include/linux/mfd/core.h | 4 ---- 2 files changed, 10 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Lee Jones
AppliedQuoted 6 lines · Andy Shevchenko
From: Heikki Krogerus <[email protected]>
The old device property API is going to be removed and replaced with the newer software node API. This prepares MFD subsystem for the transition.
Quoted 6 lines
Signed-off-by Heikki Krogerus <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/mfd-core.c | 9 +++++++++ include/linux/mfd/core.h | 4 ++++ 2 files changed, 13 insertions(+)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog