Skip to content

Commit

Permalink
mfd: core: propagate device properties to sub devices drivers
Browse files Browse the repository at this point in the history
In the similar way like we do for the platform data we propagate the device
properties. For example, in case of Intel LPSS drivers we may provide a
specific property to tell the actual device driver an additional information
such as platform name.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Andy Shevchenko authored and Rafael J. Wysocki committed Dec 7, 2015
1 parent 55f89a8 commit 4d215ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/mfd/mfd-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>
#include <linux/property.h>
#include <linux/mfd/core.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -192,6 +193,12 @@ static int mfd_add_device(struct device *parent, int id,
goto fail_alias;
}

if (cell->pset) {
ret = platform_device_add_properties(pdev, cell->pset);
if (ret)
goto fail_alias;
}

ret = mfd_platform_add_cell(pdev, cell, usage_count);
if (ret)
goto fail_alias;
Expand Down
5 changes: 5 additions & 0 deletions include/linux/mfd/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/platform_device.h>

struct irq_domain;
struct property_set;

/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
struct mfd_cell_acpi_match {
Expand Down Expand Up @@ -44,6 +45,10 @@ struct mfd_cell {
/* platform data passed to the sub devices drivers */
void *platform_data;
size_t pdata_size;

/* device properties passed to the sub devices drivers */
const struct property_set *pset;

/*
* Device Tree compatible string
* See: Documentation/devicetree/usage-model.txt Chapter 2.2 for details
Expand Down

0 comments on commit 4d215ca

Please sign in to comment.