All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-09 20:11 ` Antonio Ospite
  0 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-09 20:11 UTC (permalink / raw)
  To: linux-mmc
  Cc: Antonio Ospite, Chris Ball, Mark Brown, openezx-devel, linux-arm-kernel

Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
now (since be1a50d) it correctly degenerates and returns NULL when the
regulator framework is disabled.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---

This comes after the discussion at 
http://www.mail-archive.com/linux-mmc@vger.kernel.org/msg07443.html and 
following.

Regards,
   Antonio Ospite
   http://ao2.it

 drivers/mmc/host/pxamci.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 7257738..07e1f22 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -79,7 +79,6 @@ struct pxamci_host {
 
 static inline void pxamci_init_ocr(struct pxamci_host *host)
 {
-#ifdef CONFIG_REGULATOR
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
 	if (IS_ERR(host->vcc))
@@ -90,7 +89,7 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
 			dev_warn(mmc_dev(host->mmc),
 				"ocr_mask/setpower will not be used\n");
 	}
-#endif
+
 	if (host->vcc == NULL) {
 		/* fall-back to platform data */
 		host->mmc->ocr_avail = host->pdata ?
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-09 20:11 ` Antonio Ospite
  0 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-09 20:11 UTC (permalink / raw)
  To: linux-arm-kernel

Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
now (since be1a50d) it correctly degenerates and returns NULL when the
regulator framework is disabled.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---

This comes after the discussion at 
http://www.mail-archive.com/linux-mmc at vger.kernel.org/msg07443.html and 
following.

Regards,
   Antonio Ospite
   http://ao2.it

 drivers/mmc/host/pxamci.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 7257738..07e1f22 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -79,7 +79,6 @@ struct pxamci_host {
 
 static inline void pxamci_init_ocr(struct pxamci_host *host)
 {
-#ifdef CONFIG_REGULATOR
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
 	if (IS_ERR(host->vcc))
@@ -90,7 +89,7 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
 			dev_warn(mmc_dev(host->mmc),
 				"ocr_mask/setpower will not be used\n");
 	}
-#endif
+
 	if (host->vcc == NULL) {
 		/* fall-back to platform data */
 		host->mmc->ocr_avail = host->pdata ?
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-09 20:11 ` Antonio Ospite
@ 2011-05-09 20:15   ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-09 20:15 UTC (permalink / raw)
  To: Antonio Ospite; +Cc: linux-mmc, Chris Ball, openezx-devel, linux-arm-kernel

On Mon, May 09, 2011 at 10:11:09PM +0200, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
> now (since be1a50d) it correctly degenerates and returns NULL when the
> regulator framework is disabled.

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

But pleasse always include a plain text version of the commit
description for those who didn't memorise the entire git log.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-09 20:15   ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-09 20:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 09, 2011 at 10:11:09PM +0200, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
> now (since be1a50d) it correctly degenerates and returns NULL when the
> regulator framework is disabled.

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

But pleasse always include a plain text version of the commit
description for those who didn't memorise the entire git log.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-09 20:11 ` Antonio Ospite
@ 2011-05-09 20:23   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 28+ messages in thread
From: Russell King - ARM Linux @ 2011-05-09 20:23 UTC (permalink / raw)
  To: Antonio Ospite
  Cc: linux-mmc, openezx-devel, Chris Ball, linux-arm-kernel, Mark Brown

On Mon, May 09, 2011 at 10:11:09PM +0200, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
> now (since be1a50d) it correctly degenerates and returns NULL when the
> regulator framework is disabled.
> 
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>

NAK.  This has been proposed before, and rejected.  See the comments
against the original proposal:

http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6525/1

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-09 20:23   ` Russell King - ARM Linux
  0 siblings, 0 replies; 28+ messages in thread
From: Russell King - ARM Linux @ 2011-05-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 09, 2011 at 10:11:09PM +0200, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
> now (since be1a50d) it correctly degenerates and returns NULL when the
> regulator framework is disabled.
> 
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>

NAK.  This has been proposed before, and rejected.  See the comments
against the original proposal:

http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6525/1

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-09 20:23   ` Russell King - ARM Linux
@ 2011-05-09 20:36     ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-09 20:36 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Antonio Ospite, linux-mmc, openezx-devel, Chris Ball, linux-arm-kernel

On Mon, May 09, 2011 at 09:23:25PM +0100, Russell King - ARM Linux wrote:

> NAK.  This has been proposed before, and rejected.  See the comments
> against the original proposal:

> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6525/1

Hrm, this looks like the bodge we're doing for !REGULATOR isn't actually
helping here unless we do a NULL || IS_ERR() in the error check.  The
ifdefs are certainly fail.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-09 20:36     ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-09 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 09, 2011 at 09:23:25PM +0100, Russell King - ARM Linux wrote:

> NAK.  This has been proposed before, and rejected.  See the comments
> against the original proposal:

> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6525/1

Hrm, this looks like the bodge we're doing for !REGULATOR isn't actually
helping here unless we do a NULL || IS_ERR() in the error check.  The
ifdefs are certainly fail.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-09 20:11 ` Antonio Ospite
@ 2011-05-10 11:59   ` Sergei Shtylyov
  -1 siblings, 0 replies; 28+ messages in thread
From: Sergei Shtylyov @ 2011-05-10 11:59 UTC (permalink / raw)
  To: Antonio Ospite
  Cc: linux-mmc, openezx-devel, Chris Ball, linux-arm-kernel, Mark Brown

Hello.

On 10-05-2011 0:11, Antonio Ospite wrote:

> Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
> now (since be1a50d)

    Need the summary of that commit cited too -- for the human readers.

> it correctly degenerates and returns NULL when the
> regulator framework is disabled.

> Signed-off-by: Antonio Ospite<ospite@studenti.unina.it>

WBR, Sergei

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-10 11:59   ` Sergei Shtylyov
  0 siblings, 0 replies; 28+ messages in thread
From: Sergei Shtylyov @ 2011-05-10 11:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 10-05-2011 0:11, Antonio Ospite wrote:

> Don't wrap regulator_get() inside an #ifdef CONFIG_REGULATOR anymore, as
> now (since be1a50d)

    Need the summary of that commit cited too -- for the human readers.

> it correctly degenerates and returns NULL when the
> regulator framework is disabled.

> Signed-off-by: Antonio Ospite<ospite@studenti.unina.it>

WBR, Sergei

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-09 20:36     ` Mark Brown
@ 2011-05-10 20:02       ` Antonio Ospite
  -1 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-10 20:02 UTC (permalink / raw)
  To: Mark Brown
  Cc: Russell King - ARM Linux, linux-mmc, openezx-devel, Chris Ball,
	linux-arm-kernel, Linus Walleij


[-- Attachment #1.1: Type: text/plain, Size: 1410 bytes --]

On Mon, 9 May 2011 22:36:12 +0200
Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> On Mon, May 09, 2011 at 09:23:25PM +0100, Russell King - ARM Linux wrote:
> 
> > NAK.  This has been proposed before, and rejected.  See the comments
> > against the original proposal:
> 
> > http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6525/1
> 
> Hrm, this looks like the bodge we're doing for !REGULATOR isn't actually
> helping here unless we do a NULL || IS_ERR() in the error check.  The
> ifdefs are certainly fail.
> 

[Adding Linus Walleij to CC as he was the author of a similar NAKed
patch]

I was blindly trusting code already in mainline again, and for that I
apologize, I finally took the time to look at the implementation
of IS_ERR() and test its use, and being IS_ERR(NULL) true it is not what
we want indeed, see the attached test program.

So, I am going to remove the ifdefs anyway but use IS_ERR_OR_NULL();
how does that sound? Am I still missing anything?
Or changing the regulator_get() stub to return an error (-ENOSYS?) might
be worth it?

Thanks Russel for pointing out the issue BTW.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: IS_ERR_regulator_get.c --]
[-- Type: text/x-csrc; name="IS_ERR_regulator_get.c", Size: 1662 bytes --]

#include <stdio.h>

/* from /include/linux/compiler.h */
#define likely_notrace(x)       __builtin_expect(!!(x), 1)
#define unlikely_notrace(x)     __builtin_expect(!!(x), 0)

#define likely(x)   likely_notrace(x)
#define unlikely(x) unlikely_notrace(x)

/* from include/linux/compiler-gcc4.h */
#define __must_check            __attribute__((warn_unused_result))

/* From include/linux/err.h */
#define MAX_ERRNO       4095

#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)

static inline long __must_check IS_ERR(const void *ptr)
{

	return IS_ERR_VALUE((unsigned long)ptr);
}

static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
{
	return !ptr || IS_ERR_VALUE((unsigned long)ptr);
}


/* Mimic regulator_get() when CONFIG_REGULATOR is defined */
unsigned long *regulator_get_full()
{
	unsigned long *ptr;

	return ptr;
}

/* Mimic regulator_get() when CONFIG_REGULATOR is NOT defined */
unsigned long *regulator_get_stub()
{
	return NULL; /* or maybe return -ENOSYS; ? */
}

int main(void)
{
	unsigned long *vcc = NULL;

	vcc = regulator_get_full();
	if (IS_ERR(vcc))
		printf("full: IS_ERR         = true\n");
	else
		printf("full: IS_ERR         = false\n");

	if (IS_ERR_OR_NULL(vcc))
		printf("full: IS_ERR_OR_NULL = true\n");
	else
		printf("full: IS_ERR_OR_NULL = false\n");


	vcc = regulator_get_stub();
	if (IS_ERR(vcc))
		printf("stub: IS_ERR         = true\n");
	else
		printf("stub: IS_ERR         = false\n");

	if (IS_ERR_OR_NULL(vcc))
		printf("stub: IS_ERR_OR_NULL = true\n");
	else
		printf("stub: IS_ERR_OR_NULL = false\n");

	return 0;
}

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-10 20:02       ` Antonio Ospite
  0 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-10 20:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 9 May 2011 22:36:12 +0200
Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> On Mon, May 09, 2011 at 09:23:25PM +0100, Russell King - ARM Linux wrote:
> 
> > NAK.  This has been proposed before, and rejected.  See the comments
> > against the original proposal:
> 
> > http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6525/1
> 
> Hrm, this looks like the bodge we're doing for !REGULATOR isn't actually
> helping here unless we do a NULL || IS_ERR() in the error check.  The
> ifdefs are certainly fail.
> 

[Adding Linus Walleij to CC as he was the author of a similar NAKed
patch]

I was blindly trusting code already in mainline again, and for that I
apologize, I finally took the time to look at the implementation
of IS_ERR() and test its use, and being IS_ERR(NULL) true it is not what
we want indeed, see the attached test program.

So, I am going to remove the ifdefs anyway but use IS_ERR_OR_NULL();
how does that sound? Am I still missing anything?
Or changing the regulator_get() stub to return an error (-ENOSYS?) might
be worth it?

Thanks Russel for pointing out the issue BTW.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IS_ERR_regulator_get.c
Type: text/x-csrc
Size: 1590 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110510/12e659f9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110510/12e659f9/attachment.sig>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-10 20:02       ` Antonio Ospite
@ 2011-05-10 20:32         ` Russell King - ARM Linux
  -1 siblings, 0 replies; 28+ messages in thread
From: Russell King - ARM Linux @ 2011-05-10 20:32 UTC (permalink / raw)
  To: Antonio Ospite
  Cc: Mark Brown, linux-mmc, openezx-devel, Chris Ball,
	linux-arm-kernel, Linus Walleij

On Tue, May 10, 2011 at 10:02:14PM +0200, Antonio Ospite wrote:
> I was blindly trusting code already in mainline again, and for that I
> apologize, I finally took the time to look at the implementation
> of IS_ERR() and test its use, and being IS_ERR(NULL) true it is not what
> we want indeed, see the attached test program.
> 
> So, I am going to remove the ifdefs anyway but use IS_ERR_OR_NULL();
> how does that sound? Am I still missing anything?

That sounds a lot better, and should avoid the issue which caused me to
throw out the original patch.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-10 20:32         ` Russell King - ARM Linux
  0 siblings, 0 replies; 28+ messages in thread
From: Russell King - ARM Linux @ 2011-05-10 20:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 10, 2011 at 10:02:14PM +0200, Antonio Ospite wrote:
> I was blindly trusting code already in mainline again, and for that I
> apologize, I finally took the time to look at the implementation
> of IS_ERR() and test its use, and being IS_ERR(NULL) true it is not what
> we want indeed, see the attached test program.
> 
> So, I am going to remove the ifdefs anyway but use IS_ERR_OR_NULL();
> how does that sound? Am I still missing anything?

That sounds a lot better, and should avoid the issue which caused me to
throw out the original patch.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-10 20:02       ` Antonio Ospite
@ 2011-05-10 20:36         ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-10 20:36 UTC (permalink / raw)
  To: Antonio Ospite
  Cc: Russell King - ARM Linux, linux-mmc, openezx-devel, Chris Ball,
	linux-arm-kernel, Linus Walleij

On Tue, May 10, 2011 at 10:02:14PM +0200, Antonio Ospite wrote:

> So, I am going to remove the ifdefs anyway but use IS_ERR_OR_NULL();
> how does that sound? Am I still missing anything?

Looks good to me.

> Or changing the regulator_get() stub to return an error (-ENOSYS?) might
> be worth it?

No, the whole point of stubbing out the API is that it allows most
consumers which just do simple enables and disables to run without
needing to worry if the regulator API is compiled in or not.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-10 20:36         ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-10 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 10, 2011 at 10:02:14PM +0200, Antonio Ospite wrote:

> So, I am going to remove the ifdefs anyway but use IS_ERR_OR_NULL();
> how does that sound? Am I still missing anything?

Looks good to me.

> Or changing the regulator_get() stub to return an error (-ENOSYS?) might
> be worth it?

No, the whole point of stubbing out the API is that it allows most
consumers which just do simple enables and disables to run without
needing to worry if the regulator API is compiled in or not.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
  2011-05-10 20:36         ` Mark Brown
@ 2011-05-11 10:19           ` Antonio Ospite
  -1 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 10:19 UTC (permalink / raw)
  To: linux-mmc
  Cc: openezx-devel, Chris Ball, Antonio Ospite, linux-arm-kernel, Mark Brown

Don't wrap regulator_get() inside an ifdef CONFIG_REGULATOR anymore, as
now it degenerates and returns NULL when the regulator framework is
disabled (since commit be1a50d: regulator: Let drivers know when they
use the stub API); and use IS_ERR_OR_NULL() to handle the stub function 
correctly.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---

Changes since v1:
  - Use IS_ERR_OR_NULL() to correctly handle the stub regulator_get()
  - Put the short commit message of be1a50d so it is easier to see what it is 
    about, for the long commit and the actual code changes the git history can 
    be queried.

Thanks,
   Antonio Ospite
   http://ao2.it

 drivers/mmc/host/pxamci.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 7257738..3a89fb2 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -79,10 +79,9 @@ struct pxamci_host {
 
 static inline void pxamci_init_ocr(struct pxamci_host *host)
 {
-#ifdef CONFIG_REGULATOR
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
-	if (IS_ERR(host->vcc))
+	if (IS_ERR_OR_NULL(host->vcc))
 		host->vcc = NULL;
 	else {
 		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
@@ -90,7 +89,7 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
 			dev_warn(mmc_dev(host->mmc),
 				"ocr_mask/setpower will not be used\n");
 	}
-#endif
+
 	if (host->vcc == NULL) {
 		/* fall-back to platform data */
 		host->mmc->ocr_avail = host->pdata ?
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
@ 2011-05-11 10:19           ` Antonio Ospite
  0 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

Don't wrap regulator_get() inside an ifdef CONFIG_REGULATOR anymore, as
now it degenerates and returns NULL when the regulator framework is
disabled (since commit be1a50d: regulator: Let drivers know when they
use the stub API); and use IS_ERR_OR_NULL() to handle the stub function 
correctly.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---

Changes since v1:
  - Use IS_ERR_OR_NULL() to correctly handle the stub regulator_get()
  - Put the short commit message of be1a50d so it is easier to see what it is 
    about, for the long commit and the actual code changes the git history can 
    be queried.

Thanks,
   Antonio Ospite
   http://ao2.it

 drivers/mmc/host/pxamci.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 7257738..3a89fb2 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -79,10 +79,9 @@ struct pxamci_host {
 
 static inline void pxamci_init_ocr(struct pxamci_host *host)
 {
-#ifdef CONFIG_REGULATOR
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
-	if (IS_ERR(host->vcc))
+	if (IS_ERR_OR_NULL(host->vcc))
 		host->vcc = NULL;
 	else {
 		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
@@ -90,7 +89,7 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
 			dev_warn(mmc_dev(host->mmc),
 				"ocr_mask/setpower will not be used\n");
 	}
-#endif
+
 	if (host->vcc == NULL) {
 		/* fall-back to platform data */
 		host->mmc->ocr_avail = host->pdata ?
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 2/2] pxamci: fix coding style for multi statement conditionals
  2011-05-10 20:36         ` Mark Brown
@ 2011-05-11 10:19           ` Antonio Ospite
  -1 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 10:19 UTC (permalink / raw)
  To: linux-mmc
  Cc: openezx-devel, Chris Ball, Antonio Ospite, linux-arm-kernel, Mark Brown

Put parentheses around single-statement 'if' branches when the else
branch is not a single statement as suggested in
Documentation/CodingStyle Chapter 3.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---
 drivers/mmc/host/pxamci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 3a89fb2..fbdb21e 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -81,9 +81,9 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
 {
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
-	if (IS_ERR_OR_NULL(host->vcc))
+	if (IS_ERR_OR_NULL(host->vcc)) {
 		host->vcc = NULL;
-	else {
+	} else {
 		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
 		if (host->pdata && host->pdata->ocr_mask)
 			dev_warn(mmc_dev(host->mmc),
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 2/2] pxamci: fix coding style for multi statement conditionals
@ 2011-05-11 10:19           ` Antonio Ospite
  0 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

Put parentheses around single-statement 'if' branches when the else
branch is not a single statement as suggested in
Documentation/CodingStyle Chapter 3.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---
 drivers/mmc/host/pxamci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 3a89fb2..fbdb21e 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -81,9 +81,9 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
 {
 	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
 
-	if (IS_ERR_OR_NULL(host->vcc))
+	if (IS_ERR_OR_NULL(host->vcc)) {
 		host->vcc = NULL;
-	else {
+	} else {
 		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
 		if (host->pdata && host->pdata->ocr_mask)
 			dev_warn(mmc_dev(host->mmc),
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
  2011-05-10 20:02       ` Antonio Ospite
@ 2011-05-11 10:26         ` Antonio Ospite
  -1 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 10:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: openezx-devel, Russell King - ARM Linux, Linus Walleij,
	linux-mmc, Chris Ball, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

On Tue, 10 May 2011 22:02:14 +0200
Antonio Ospite <ospite@studenti.unina.it> wrote:
 
> I was blindly trusting code already in mainline again, and for that I
> apologize, I finally took the time to look at the implementation
> of IS_ERR() and test its use, and being IS_ERR(NULL) true it is not what
> we want indeed, see the attached test program.
> 

Just for the records, I meant to say "being IS_ERR(NULL) _false_" but
you got it anyways.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR
@ 2011-05-11 10:26         ` Antonio Ospite
  0 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 10 May 2011 22:02:14 +0200
Antonio Ospite <ospite@studenti.unina.it> wrote:
 
> I was blindly trusting code already in mainline again, and for that I
> apologize, I finally took the time to look at the implementation
> of IS_ERR() and test its use, and being IS_ERR(NULL) true it is not what
> we want indeed, see the attached test program.
> 

Just for the records, I meant to say "being IS_ERR(NULL) _false_" but
you got it anyways.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110511/8314eb4a/attachment.sig>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
  2011-05-11 10:19           ` Antonio Ospite
@ 2011-05-11 13:07             ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-11 13:07 UTC (permalink / raw)
  To: Antonio Ospite; +Cc: openezx-devel, Chris Ball, linux-mmc, linux-arm-kernel

On Wed, May 11, 2011 at 12:19:05PM +0200, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an ifdef CONFIG_REGULATOR anymore, as
> now it degenerates and returns NULL when the regulator framework is
> disabled (since commit be1a50d: regulator: Let drivers know when they
> use the stub API); and use IS_ERR_OR_NULL() to handle the stub function 
> correctly.
> 
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
@ 2011-05-11 13:07             ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2011-05-11 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 11, 2011 at 12:19:05PM +0200, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an ifdef CONFIG_REGULATOR anymore, as
> now it degenerates and returns NULL when the regulator framework is
> disabled (since commit be1a50d: regulator: Let drivers know when they
> use the stub API); and use IS_ERR_OR_NULL() to handle the stub function 
> correctly.
> 
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
  2011-05-11 10:19           ` Antonio Ospite
@ 2011-05-11 14:41             ` Chris Ball
  -1 siblings, 0 replies; 28+ messages in thread
From: Chris Ball @ 2011-05-11 14:41 UTC (permalink / raw)
  To: Antonio Ospite; +Cc: openezx-devel, linux-mmc, linux-arm-kernel, Mark Brown

Hi Antonio,

On Wed, May 11 2011, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an ifdef CONFIG_REGULATOR anymore, as
> now it degenerates and returns NULL when the regulator framework is
> disabled (since commit be1a50d: regulator: Let drivers know when they
> use the stub API); and use IS_ERR_OR_NULL() to handle the stub function 
> correctly.
>
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
> ---
>
> Changes since v1:
>   - Use IS_ERR_OR_NULL() to correctly handle the stub regulator_get()
>   - Put the short commit message of be1a50d so it is easier to see what it is 
>     about, for the long commit and the actual code changes the git history can 
>     be queried.
>
> Thanks,
>    Antonio Ospite
>    http://ao2.it
>
>  drivers/mmc/host/pxamci.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
> index 7257738..3a89fb2 100644
> --- a/drivers/mmc/host/pxamci.c
> +++ b/drivers/mmc/host/pxamci.c
> @@ -79,10 +79,9 @@ struct pxamci_host {
>  
>  static inline void pxamci_init_ocr(struct pxamci_host *host)
>  {
> -#ifdef CONFIG_REGULATOR
>  	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
>  
> -	if (IS_ERR(host->vcc))
> +	if (IS_ERR_OR_NULL(host->vcc))
>  		host->vcc = NULL;
>  	else {
>  		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
> @@ -90,7 +89,7 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
>  			dev_warn(mmc_dev(host->mmc),
>  				"ocr_mask/setpower will not be used\n");
>  	}
> -#endif
> +
>  	if (host->vcc == NULL) {
>  		/* fall-back to platform data */
>  		host->mmc->ocr_avail = host->pdata ?

Thanks, I've merged this and squashed the 2/2 punctuation patch into it;
it didn't seem worth having a separate patch when both touch the same code.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
@ 2011-05-11 14:41             ` Chris Ball
  0 siblings, 0 replies; 28+ messages in thread
From: Chris Ball @ 2011-05-11 14:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Antonio,

On Wed, May 11 2011, Antonio Ospite wrote:
> Don't wrap regulator_get() inside an ifdef CONFIG_REGULATOR anymore, as
> now it degenerates and returns NULL when the regulator framework is
> disabled (since commit be1a50d: regulator: Let drivers know when they
> use the stub API); and use IS_ERR_OR_NULL() to handle the stub function 
> correctly.
>
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
> ---
>
> Changes since v1:
>   - Use IS_ERR_OR_NULL() to correctly handle the stub regulator_get()
>   - Put the short commit message of be1a50d so it is easier to see what it is 
>     about, for the long commit and the actual code changes the git history can 
>     be queried.
>
> Thanks,
>    Antonio Ospite
>    http://ao2.it
>
>  drivers/mmc/host/pxamci.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
> index 7257738..3a89fb2 100644
> --- a/drivers/mmc/host/pxamci.c
> +++ b/drivers/mmc/host/pxamci.c
> @@ -79,10 +79,9 @@ struct pxamci_host {
>  
>  static inline void pxamci_init_ocr(struct pxamci_host *host)
>  {
> -#ifdef CONFIG_REGULATOR
>  	host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc");
>  
> -	if (IS_ERR(host->vcc))
> +	if (IS_ERR_OR_NULL(host->vcc))
>  		host->vcc = NULL;
>  	else {
>  		host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
> @@ -90,7 +89,7 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
>  			dev_warn(mmc_dev(host->mmc),
>  				"ocr_mask/setpower will not be used\n");
>  	}
> -#endif
> +
>  	if (host->vcc == NULL) {
>  		/* fall-back to platform data */
>  		host->mmc->ocr_avail = host->pdata ?

Thanks, I've merged this and squashed the 2/2 punctuation patch into it;
it didn't seem worth having a separate patch when both touch the same code.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
  2011-05-11 14:41             ` Chris Ball
@ 2011-05-11 20:19               ` Antonio Ospite
  -1 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 20:19 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, openezx-devel, linux-arm-kernel, Mark Brown

[-- Attachment #1: Type: text/plain, Size: 690 bytes --]

On Wed, 11 May 2011 10:41:43 -0400
Chris Ball <cjb@laptop.org> wrote:

> On Wed, May 11 2011, Antonio Ospite wrote:
[...]
> >  drivers/mmc/host/pxamci.c |    5 ++---
> >  1 files changed, 2 insertions(+), 3 deletions(-)
[...]
> 
> Thanks, I've merged this and squashed the 2/2 punctuation patch into it;
> it didn't seem worth having a separate patch when both touch the same code.
> 

That's perfectly fine with me.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR
@ 2011-05-11 20:19               ` Antonio Ospite
  0 siblings, 0 replies; 28+ messages in thread
From: Antonio Ospite @ 2011-05-11 20:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 11 May 2011 10:41:43 -0400
Chris Ball <cjb@laptop.org> wrote:

> On Wed, May 11 2011, Antonio Ospite wrote:
[...]
> >  drivers/mmc/host/pxamci.c |    5 ++---
> >  1 files changed, 2 insertions(+), 3 deletions(-)
[...]
> 
> Thanks, I've merged this and squashed the 2/2 punctuation patch into it;
> it didn't seem worth having a separate patch when both touch the same code.
> 

That's perfectly fine with me.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110511/260c91c5/attachment.sig>

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2011-05-11 20:19 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-09 20:11 [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR Antonio Ospite
2011-05-09 20:11 ` Antonio Ospite
2011-05-09 20:15 ` Mark Brown
2011-05-09 20:15   ` Mark Brown
2011-05-09 20:23 ` Russell King - ARM Linux
2011-05-09 20:23   ` Russell King - ARM Linux
2011-05-09 20:36   ` Mark Brown
2011-05-09 20:36     ` Mark Brown
2011-05-10 20:02     ` Antonio Ospite
2011-05-10 20:02       ` Antonio Ospite
2011-05-10 20:32       ` Russell King - ARM Linux
2011-05-10 20:32         ` Russell King - ARM Linux
2011-05-10 20:36       ` Mark Brown
2011-05-10 20:36         ` Mark Brown
2011-05-11 10:19         ` [PATCH v2 1/2] pxamci: remove the ifdef CONFIG_REGULATOR Antonio Ospite
2011-05-11 10:19           ` Antonio Ospite
2011-05-11 13:07           ` Mark Brown
2011-05-11 13:07             ` Mark Brown
2011-05-11 14:41           ` Chris Ball
2011-05-11 14:41             ` Chris Ball
2011-05-11 20:19             ` Antonio Ospite
2011-05-11 20:19               ` Antonio Ospite
2011-05-11 10:19         ` [PATCH 2/2] pxamci: fix coding style for multi statement conditionals Antonio Ospite
2011-05-11 10:19           ` Antonio Ospite
2011-05-11 10:26       ` [PATCH] pxamci: remove an ifdef about CONFIG_REGULATOR Antonio Ospite
2011-05-11 10:26         ` Antonio Ospite
2011-05-10 11:59 ` Sergei Shtylyov
2011-05-10 11:59   ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.