diff mbox series

[v3,04/10] mfd: cs5535-mfd: Register clients using their own dedicated MFD cell entries

Message ID 20191024163832.31326-5-lee.jones@linaro.org
State Superseded
Headers show
Series Simplify MFD Core | expand

Commit Message

Lee Jones Oct. 24, 2019, 4:38 p.m. UTC
CS5535 is the only user of mfd_clone_cell().  It makes more sense to
register child devices in the traditional way and remove the quite
bespoke mfd_clone_cell() call from the MFD API.

Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 drivers/mfd/cs5535-mfd.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

-- 
2.17.1

Comments

Daniel Thompson Oct. 25, 2019, 8:50 a.m. UTC | #1
On Thu, Oct 24, 2019 at 05:38:26PM +0100, Lee Jones wrote:
> CS5535 is the only user of mfd_clone_cell().  It makes more sense to

> register child devices in the traditional way and remove the quite

> bespoke mfd_clone_cell() call from the MFD API.

> 

> Signed-off-by: Lee Jones <lee.jones@linaro.org>


Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>



> ---

>  drivers/mfd/cs5535-mfd.c | 25 ++++++++++++++++---------

>  1 file changed, 16 insertions(+), 9 deletions(-)

> 

> diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c

> index 27fa8fa1ec9b..4c034c9f2303 100644

> --- a/drivers/mfd/cs5535-mfd.c

> +++ b/drivers/mfd/cs5535-mfd.c

> @@ -50,16 +50,19 @@ static struct mfd_cell cs5535_mfd_cells[] = {

>  		.num_resources = 1,

>  		.resources = &cs5535_mfd_resources[PMS_BAR],

>  	},

> +};

> +

> +static struct mfd_cell cs5535_olpc_mfd_cells[] = {

>  	{

> -		.name = "cs5535-acpi",

> +		.name = "olpc-xo1-pm-acpi",

> +		.num_resources = 1,

> +		.resources = &cs5535_mfd_resources[ACPI_BAR],

> +	},

> +	{

> +		.name = "olpc-xo1-sci-acpi",

>  		.num_resources = 1,

>  		.resources = &cs5535_mfd_resources[ACPI_BAR],

>  	},

> -};

> -

> -static const char *olpc_acpi_clones[] = {

> -	"olpc-xo1-pm-acpi",

> -	"olpc-xo1-sci-acpi"

>  };

>  

>  static int cs5535_mfd_probe(struct pci_dev *pdev,

> @@ -101,10 +104,14 @@ static int cs5535_mfd_probe(struct pci_dev *pdev,

>  			goto err_remove_devices;

>  		}

>  

> -		err = mfd_clone_cell("cs5535-acpi", olpc_acpi_clones,

> -				     ARRAY_SIZE(olpc_acpi_clones));

> +		err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,

> +				      cs5535_olpc_mfd_cells,

> +				      ARRAY_SIZE(cs5535_olpc_mfd_cells),

> +				      NULL, 0, NULL);

>  		if (err) {

> -			dev_err(&pdev->dev, "Failed to clone MFD cell\n");

> +			dev_err(&pdev->dev,

> +				"Failed to add CS5535 OLPC sub-devices: %d\n",

> +				err);

>  			goto err_release_acpi;

>  		}

>  	}

> -- 

> 2.17.1

>
diff mbox series

Patch

diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
index 27fa8fa1ec9b..4c034c9f2303 100644
--- a/drivers/mfd/cs5535-mfd.c
+++ b/drivers/mfd/cs5535-mfd.c
@@ -50,16 +50,19 @@  static struct mfd_cell cs5535_mfd_cells[] = {
 		.num_resources = 1,
 		.resources = &cs5535_mfd_resources[PMS_BAR],
 	},
+};
+
+static struct mfd_cell cs5535_olpc_mfd_cells[] = {
 	{
-		.name = "cs5535-acpi",
+		.name = "olpc-xo1-pm-acpi",
+		.num_resources = 1,
+		.resources = &cs5535_mfd_resources[ACPI_BAR],
+	},
+	{
+		.name = "olpc-xo1-sci-acpi",
 		.num_resources = 1,
 		.resources = &cs5535_mfd_resources[ACPI_BAR],
 	},
-};
-
-static const char *olpc_acpi_clones[] = {
-	"olpc-xo1-pm-acpi",
-	"olpc-xo1-sci-acpi"
 };
 
 static int cs5535_mfd_probe(struct pci_dev *pdev,
@@ -101,10 +104,14 @@  static int cs5535_mfd_probe(struct pci_dev *pdev,
 			goto err_remove_devices;
 		}
 
-		err = mfd_clone_cell("cs5535-acpi", olpc_acpi_clones,
-				     ARRAY_SIZE(olpc_acpi_clones));
+		err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
+				      cs5535_olpc_mfd_cells,
+				      ARRAY_SIZE(cs5535_olpc_mfd_cells),
+				      NULL, 0, NULL);
 		if (err) {
-			dev_err(&pdev->dev, "Failed to clone MFD cell\n");
+			dev_err(&pdev->dev,
+				"Failed to add CS5535 OLPC sub-devices: %d\n",
+				err);
 			goto err_release_acpi;
 		}
 	}