Skip to contentSkip to conversation

mtd: nand: gpmi-nand: let the driver core handle pinctrl

PATCH New Huang Shijie 6 participants 16 messages Aug 1, 2013 – Sep 2, 2013 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 29 lines · Lothar Waßmann

without this patch the driver fails to load with -EBUSY.

---
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 --------
  1 files changed, 0 insertions(+), 8 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -7
index b741a6c..f557a1d 100644
@@ -520,7 +520,6 @@ err_clock:
 
  static int acquire_resources(struct gpmi_nand_data *this)
  {
-	struct pinctrl *pinctrl;
  	int ret;
 
  	ret = acquire_register_block(this, GPMI_NAND_GPMI_REGS_ADDR_RES_NAME);
@@ -539,19 +538,12 @@ static int acquire_resources(struct gpmi_nand_data *this)
  	if (ret)
  		goto exit_dma_channels;
 
-	pinctrl = devm_pinctrl_get_select_default(&this->pdev->dev);
-	if (IS_ERR(pinctrl)) {
-		ret = PTR_ERR(pinctrl);
-		goto exit_pin;
-	}
-

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static int acquire_resources(struct gpmi_nand_data *this) · line 549

Quoted 10 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -1
  	ret = gpmi_get_clks(this);
  	if (ret)
  		goto exit_clock;
  	return 0;
 
  exit_clock:
-exit_pin:
  	release_dma_channels(this);
  exit_dma_channels:
  	release_bch_irq(this);

The similar patches have been sent for several times. So this is a duplicated patch.

thanks
Huang Shijie

A message that is not in the archive (sent off-list or not yet received): [email protected]

author Acked-by
#3 lore raw

Re: [PATCH 05/25] mtd: nand: gpmi-nand: use more sensible error codes at various places

Quoted 28 lines · Lothar Waßmann
---
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
index 4f7ec59..9a47189 100644
@@ -355,7 +355,7 @@ static int acquire_register_block(struct gpmi_nand_data *this,
  	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name);
  	if (!r) {
  		pr_err("Can't get resource for %s\n", res_name);
-		return -ENXIO;
+		return -ENODEV;
  	}
 
  	p = ioremap(r->start, resource_size(r));
@@ -396,7 +396,7 @@ static int acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h)
  	r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name);
  	if (!r) {
  		pr_err("Can't get resource for %s\n", res_name);
-		return -ENXIO;
+		return -ENODEV;
  	}
 
  	err = request_irq(r->start, irq_h, 0, res_name, this);

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static int gpmi_nand_probe(struct platform_device *pdev) · line 1603

Quoted 8 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +1 -1
@@ -1597,7 +1597,7 @@ static int gpmi_nand_probe(struct platform_device *pdev)
  		pdev->id_entry = of_id->data;
  	} else {
  		pr_err("Failed to find the right device id.\n");
-		return -ENOMEM;
+		return -ENODEV;
  	}
 
  	this = kzalloc(sizeof(*this), GFP_KERNEL);

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

Quoted 23 lines · Lothar Waßmann
---
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
index f557a1d..4f7ec59 100644
@@ -1569,19 +1569,19 @@ static const struct platform_device_id gpmi_ids[] = {
  	{ .name = "imx23-gpmi-nand", .driver_data = IS_MX23, },
  	{ .name = "imx28-gpmi-nand", .driver_data = IS_MX28, },
  	{ .name = "imx6q-gpmi-nand", .driver_data = IS_MX6Q, },
-	{},
+	{}
  };
 
  static const struct of_device_id gpmi_nand_id_table[] = {
  	{
  		.compatible = "fsl,imx23-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX23]
+		.data = (void *)&gpmi_ids[IS_MX23],
  	}, {

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static const struct platform_device_id gpmi_ids[] = { · line 1587

Quoted 10 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
  		.compatible = "fsl,imx28-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX28]
+		.data = (void *)&gpmi_ids[IS_MX28],
  	}, {
  		.compatible = "fsl,imx6q-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX6Q]
+		.data = (void *)&gpmi_ids[IS_MX6Q],
  	}, {}
  };
  MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);

is it any bad influence if we do not apply this patch?

I am not clear what we can benefit from this patch.

thanks
Huang Shijie

#6 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

Hi,

Quoted 36 lines · Huang Shijie
Quoted 23 lines · Lothar Waßmann
---
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
index f557a1d..4f7ec59 100644
@@ -1569,19 +1569,19 @@ static const struct platform_device_id gpmi_ids[] = {
  	{ .name = "imx23-gpmi-nand", .driver_data = IS_MX23, },
  	{ .name = "imx28-gpmi-nand", .driver_data = IS_MX28, },
  	{ .name = "imx6q-gpmi-nand", .driver_data = IS_MX6Q, },
-	{},
+	{}
  };
 
  static const struct of_device_id gpmi_nand_id_table[] = {
  	{
  		.compatible = "fsl,imx23-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX23]
+		.data = (void *)&gpmi_ids[IS_MX23],
  	}, {

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static const struct platform_device_id gpmi_ids[] = { · line 1587

Quoted 10 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
  		.compatible = "fsl,imx28-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX28]
+		.data = (void *)&gpmi_ids[IS_MX28],
  	}, {
  		.compatible = "fsl,imx6q-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX6Q]
+		.data = (void *)&gpmi_ids[IS_MX6Q],
  	}, {}
  };
  MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);

is it any bad influence if we do not apply this patch?

Quoted 2 lines

I am not clear what we can benefit from this patch.

less eye sore when looking at the code and eventual copies of it in other places.

Lothar Waßmann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | [email protected]
___________________________________________________________
author Acked-by
#7 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

Quoted 39 lines · Lothar Waßmann

Hi,

Quoted 36 lines · Huang Shijie
Quoted 23 lines · Lothar Waßmann
---
   drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 ++++----
   1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
index f557a1d..4f7ec59 100644
@@ -1569,19 +1569,19 @@ static const struct platform_device_id gpmi_ids[] = {
   	{ .name = "imx23-gpmi-nand", .driver_data = IS_MX23, },
   	{ .name = "imx28-gpmi-nand", .driver_data = IS_MX28, },
   	{ .name = "imx6q-gpmi-nand", .driver_data = IS_MX6Q, },
-	{},
+	{}
   };
 
   static const struct of_device_id gpmi_nand_id_table[] = {
   	{
   		.compatible = "fsl,imx23-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX23]
+		.data = (void *)&gpmi_ids[IS_MX23],
   	}, {

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static const struct platform_device_id gpmi_ids[] = { · line 1587

Quoted 10 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
   		.compatible = "fsl,imx28-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX28]
+		.data = (void *)&gpmi_ids[IS_MX28],
   	}, {
   		.compatible = "fsl,imx6q-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX6Q]
+		.data = (void *)&gpmi_ids[IS_MX6Q],
   	}, {}
   };
   MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);

is it any bad influence if we do not apply this patch?

Quoted 5 lines
Quoted 2 lines

I am not clear what we can benefit from this patch.

less eye sore when looking at the code and eventual copies of it in other places.

ok. thanks for fix this.

#8 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

In reply to Lothar Waßmann
Quoted 39 lines · Lothar Waßmann

Hi,

Quoted 36 lines · Huang Shijie
Quoted 23 lines · Lothar Waßmann
---
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
index f557a1d..4f7ec59 100644
@@ -1569,19 +1569,19 @@ static const struct platform_device_id gpmi_ids[] = {
  	{ .name = "imx23-gpmi-nand", .driver_data = IS_MX23, },
  	{ .name = "imx28-gpmi-nand", .driver_data = IS_MX28, },
  	{ .name = "imx6q-gpmi-nand", .driver_data = IS_MX6Q, },
-	{},
+	{}
  };
 
  static const struct of_device_id gpmi_nand_id_table[] = {
  	{
  		.compatible = "fsl,imx23-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX23]
+		.data = (void *)&gpmi_ids[IS_MX23],
  	}, {

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static const struct platform_device_id gpmi_ids[] = { · line 1587

Quoted 10 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +2 -2
  		.compatible = "fsl,imx28-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX28]
+		.data = (void *)&gpmi_ids[IS_MX28],
  	}, {
  		.compatible = "fsl,imx6q-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX6Q]
+		.data = (void *)&gpmi_ids[IS_MX6Q],
  	}, {}
  };
  MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);

is it any bad influence if we do not apply this patch?

Quoted 4 lines
Quoted 2 lines

I am not clear what we can benefit from this patch.

less eye sore when looking at the code and eventual copies of it in other places.

For some reasons I do not have these patches in my mailbox. Would you please re-send them, and add the acks there too?

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#9 lore raw

PATCH 3/25 mtd: nand: gpmi-nand: let the driver core handle pinctrl

without this patch the driver fails to load with -EBUSY.

---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -8
index b741a6c..f557a1d 100644
@@ -520,7 +520,6 @@ err_clock:
 
 static int acquire_resources(struct gpmi_nand_data *this)
 {
-	struct pinctrl *pinctrl;
 	int ret;
 
 	ret = acquire_register_block(this, GPMI_NAND_GPMI_REGS_ADDR_RES_NAME);
@@ -539,19 +538,12 @@ static int acquire_resources(struct gpmi_nand_data *this)
 	if (ret)
 		goto exit_dma_channels;
 
-	pinctrl = devm_pinctrl_get_select_default(&this->pdev->dev);
-	if (IS_ERR(pinctrl)) {
-		ret = PTR_ERR(pinctrl);
-		goto exit_pin;
-	}
-
 	ret = gpmi_get_clks(this);
 	if (ret)
 		goto exit_clock;
 	return 0;
 
 exit_clock:
-exit_pin:
 	release_dma_channels(this);
 exit_dma_channels:
 	release_bch_irq(this);
Signature · 1 line
1.7.2.5
#10 lore raw

PATCH v2 1/2 mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

In reply to Artem Bityutskiy
---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +4 -4
index f557a1d..4f7ec59 100644
@@ -1569,19 +1569,19 @@ static const struct platform_device_id gpmi_ids[] = {
 	{ .name = "imx23-gpmi-nand", .driver_data = IS_MX23, },
 	{ .name = "imx28-gpmi-nand", .driver_data = IS_MX28, },
 	{ .name = "imx6q-gpmi-nand", .driver_data = IS_MX6Q, },
-	{},
+	{}
 };
 
 static const struct of_device_id gpmi_nand_id_table[] = {
 	{
 		.compatible = "fsl,imx23-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX23]
+		.data = (void *)&gpmi_ids[IS_MX23],
 	}, {
 		.compatible = "fsl,imx28-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX28]
+		.data = (void *)&gpmi_ids[IS_MX28],
 	}, {
 		.compatible = "fsl,imx6q-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX6Q]
+		.data = (void *)&gpmi_ids[IS_MX6Q],
 	}, {}
 };
 MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);
Signature · 1 line
1.7.2.5
#12 lore raw

Re: [PATCH/RESEND v2 0/2] mtd: nand: gpmi-nand: cleanup patches

Quoted 1 line · Lothar Waßmann

Sorry, sent out the wrong files.

Pushed both to l2-mtd.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#13 lore raw

PATCH v2 1/2 mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

In reply to Artem Bityutskiy
---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +4 -4
index f557a1d..4f7ec59 100644
@@ -1569,19 +1569,19 @@ static const struct platform_device_id gpmi_ids[] = {
 	{ .name = "imx23-gpmi-nand", .driver_data = IS_MX23, },
 	{ .name = "imx28-gpmi-nand", .driver_data = IS_MX28, },
 	{ .name = "imx6q-gpmi-nand", .driver_data = IS_MX6Q, },
-	{},
+	{}
 };
 
 static const struct of_device_id gpmi_nand_id_table[] = {
 	{
 		.compatible = "fsl,imx23-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX23]
+		.data = (void *)&gpmi_ids[IS_MX23],
 	}, {
 		.compatible = "fsl,imx28-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX28]
+		.data = (void *)&gpmi_ids[IS_MX28],
 	}, {
 		.compatible = "fsl,imx6q-gpmi-nand",
-		.data = (void *)&gpmi_ids[IS_MX6Q]
+		.data = (void *)&gpmi_ids[IS_MX6Q],
 	}, {}
 };
 MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);
Signature · 1 line
1.7.2.5
#14 lore raw

PATCH v2 2/2 mtd: nand: gpmi-nand: use more sensible error codes at various places

In reply to Artem Bityutskiy
---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +3 -3
index 4f7ec59..9a47189 100644
@@ -355,7 +355,7 @@ static int acquire_register_block(struct gpmi_nand_data *this,
 	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name);
 	if (!r) {
 		pr_err("Can't get resource for %s\n", res_name);
-		return -ENXIO;
+		return -ENODEV;
 	}
 
 	p = ioremap(r->start, resource_size(r));
@@ -396,7 +396,7 @@ static int acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h)
 	r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name);
 	if (!r) {
 		pr_err("Can't get resource for %s\n", res_name);
-		return -ENXIO;
+		return -ENODEV;
 	}
 
 	err = request_irq(r->start, irq_h, 0, res_name, this);
@@ -1597,7 +1597,7 @@ static int gpmi_nand_probe(struct platform_device *pdev)
 		pdev->id_entry = of_id->data;
 	} else {
 		pr_err("Failed to find the right device id.\n");
-		return -ENOMEM;
+		return -ENODEV;
 	}
 
 	this = kzalloc(sizeof(*this), GFP_KERNEL);
Signature · 1 line
1.7.2.5
#15 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

In reply to Lothar Waßmann
Quoted 7 lines · Lothar Waßmann
Quoted 4 lines · Huang Shijie

is it any bad influence if we do not apply this patch?

I am not clear what we can benefit from this patch.

less eye sore when looking at the code and eventual copies of it in other places.

But it's actually a *good* practice to have the redundant commas at the end of the line, in the general case.

It does absolutely no harm, and makes the final line appear *consistent* with the other lines. I don't see why it would make your eye sore on the final line when it's there and necessary on the previous lines.

It's also not as if you're going to miss the closing brace and the fact that it's the end of the struct. The indentation should always make that clear regardless of the comma.

If we don't include it, we end up with patches which are less readable, when we add a field to an initialiser. Instead of this nice and obvious patch, for example:

@@ 1,4 1,5
struct wombat = {
.somefield = foo,bar
.otherfield = bar,
+ .newfield = baz,
};

... we end up with this less obvious and harder-to-read patch:

@@ 1,4 1,5
struct wombat = {
.somefield = foo,
- .otherfield = bar
+ .otherfield = bar,
+ .newfield = baz
};

Now, admittedly that's the *general* case, and the ones you've removed commas from are very unlikely to ever have new members added after them. Especially the one that's a NULL sentinel at the end of an ID match list. But I'm just not sure I approve of the concept of removing the commas. I'm happier with them present, and a general habit of including them.

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation
#16 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

Quoted 8 lines · David Woodhouse

On Thu, 2013-08-01 at 07:50 +0200, Lothar Waßmann wrote:

Now, admittedly that's the *general* case, and the ones you've removed commas from are very unlikely to ever have new members added after them. Especially the one that's a NULL sentinel at the end of an ID match list. But I'm just not sure I approve of the concept of removing the commas. I'm happier with them present, and a general habit of including them.

Hi David:
thanks for explanations.

If you do not like this patch, you can remove it.

thanks
Huang Shijie

#17 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

In reply to David Woodhouse

Hi,

Quoted 9 lines · David Woodhouse
Quoted 7 lines · Lothar Waßmann
Quoted 4 lines · Huang Shijie

is it any bad influence if we do not apply this patch?

I am not clear what we can benefit from this patch.

less eye sore when looking at the code and eventual copies of it in other places.

Quoted 7 lines

But it's actually a *good* practice to have the redundant commas at the end of the line, in the general case.

It does absolutely no harm, and makes the final line appear *consistent* with the other lines. I don't see why it would make your eye sore on the final line when it's there and necessary on the previous lines.

My patch _added_ the commas and _made_ the last lines consistent with the other ones...

Lothar Waßmann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | [email protected]
___________________________________________________________
#18 lore raw

Re: [PATCH 04/25] mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)

Quoted 2 lines · Lothar Waßmann

My patch _added_ the commas and _made_ the last lines consistent with the other ones...

Ah, right. I looked at the first hunk of the patch, which *is* actually removing a comma. Missed the fact that the other three changes were *adding* commas instead.

So much for consistency :)

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation