Skip to contentSkip to conversation

ARM: pxa: fix build failure for regulator consumer in em-x270.c

PATCH New Paul Gortmaker 4 participants 23 messages Mar 5, 2012 – Mar 30, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0 (linux-next)

"regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. Strip them out here too.

arch/arm/mach-pxa/em-x270.c +7 -8
index d80c0ba..c8f3293 100644
@@ -1083,20 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
 }
 
 /* DA9030 related initializations */
-#define REGULATOR_CONSUMER(_name, _dev, _supply)			       \
+#define REGULATOR_CONSUMER(_name, _supply)			       \
 	static struct regulator_consumer_supply _name##_consumers[] = {	\
 		{							\
-			.dev = _dev,					\
 			.supply = _supply,				\
 		},							\
 	}
 
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
-REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
-REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
-REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
+REGULATOR_CONSUMER(ldo3, "vcc gps");
+REGULATOR_CONSUMER(ldo5, "vcc cam");
+REGULATOR_CONSUMER(ldo10, "vcc sdio");
+REGULATOR_CONSUMER(ldo12, "vcc usb");
+REGULATOR_CONSUMER(ldo19, "vcc gprs");
+REGULATOR_CONSUMER(buck2, "vcc_core");
 
 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask)		\
 	static struct regulator_init_data _ldo##_data = {		\
Signature · 1 line
1.7.9.1
#1 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Also Cc: Haojian Zhuang <[email protected]>

Quoted 9 lines · Paul Gortmaker

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0 (linux-next)

"regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. Strip them out here too.

You've missed the scissors line:
---

The patch itself:

Thanks

Quoted 33 lines
arch/arm/mach-pxa/em-x270.c +7 -8
index d80c0ba..c8f3293 100644
@@ -1083,20 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
 }
 
 /* DA9030 related initializations */
-#define REGULATOR_CONSUMER(_name, _dev, _supply)			       \
+#define REGULATOR_CONSUMER(_name, _supply)			       \
 	static struct regulator_consumer_supply _name##_consumers[] = {	\
 		{							\
-			.dev = _dev,					\
 			.supply = _supply,				\
 		},							\
 	}
 
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
-REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
-REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
-REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
+REGULATOR_CONSUMER(ldo3, "vcc gps");
+REGULATOR_CONSUMER(ldo5, "vcc cam");
+REGULATOR_CONSUMER(ldo10, "vcc sdio");
+REGULATOR_CONSUMER(ldo12, "vcc usb");
+REGULATOR_CONSUMER(ldo19, "vcc gprs");
+REGULATOR_CONSUMER(buck2, "vcc_core");
 
 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask)		\
 	static struct regulator_init_data _ldo##_data = {		\
Signature · 2 lines
Regards,
Igor.
maintainer
#2 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 13 lines · Igor Grinberg

Also Cc: Haojian Zhuang <[email protected]>

Quoted 9 lines · Paul Gortmaker

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0 (linux-next)

? "regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. ?Strip them out here too.

Quoted 9 lines

You've missed the scissors line:
---

The patch itself:

Thanks

Mark,

Could you pick up this patch since it's depend on latest change on regulator?

Best Regards
Haojian

#3 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 1 line · Haojian Zhuang

Could you pick up this patch since it's depend on latest change on regulator?

There's no direct dependency, there's been no need to use that struct
member for years - should be safe to just apply via the PXA tree. If
you do want it to go via regulator please resend, I didn't keep a copy
of the patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120306/7b99136b/attachment.sig>

maintainer
#4 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 8 lines · Mark Brown
Quoted 1 line · Haojian Zhuang

Could you pick up this patch since it's depend on latest change on regulator?

There's no direct dependency, there's been no need to use that struct member for years - should be safe to just apply via the PXA tree. ?If you do want it to go via regulator please resend, I didn't keep a copy of the patch.

OK. Let me merge this patch.

Best Regards
Haojian

#5 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

In reply to Paul Gortmaker

On Mon, Mar 5, 2012 at 6:12 PM, Paul Gortmaker
<[email protected]> wrote:

[...]

arch/arm/mach-pxa/em-x270.c static void __init em_x270_userspace_consumers_init(void) · line 1098

Quoted 12 lines
arch/arm/mach-pxa/em-x270.c +6 -6
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
-REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
-REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
-REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
+REGULATOR_CONSUMER(ldo3, "vcc gps");
+REGULATOR_CONSUMER(ldo5, "vcc cam");
+REGULATOR_CONSUMER(ldo10, "vcc sdio");
+REGULATOR_CONSUMER(ldo12, "vcc usb");
+REGULATOR_CONSUMER(ldo19, "vcc gprs");
+REGULATOR_CONSUMER(buck2, "vcc_core");

Based on today's discussions, I'm no longer convinced the above is right. If I understand correctly, for the case of say the top one:

em_x270_gps_userspace_consumer

I need to go find that struct, determine that it has a .name entry like:

.name = "reg-userspace-consumer",

and then use (for each case) something like:

REGULATOR_SUPPLY("vcc gps", "reg-userspace-consumer")

The above wrapper for REGULATOR_CONSUMER would have to be changed to either use or inline the REGULATOR_SUPPLY.

Let me know if I'm on the right track here. This code is completely
foreign to me. As such, the naming in the magician_defconfig
patch is also probably needing rework (i.e. it needs the corresponding value for .name, and not the name of the parent struct itself.)

THanks,
Paul.
--

Quoted 10 lines

?#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) ? ? ? ? ? ? ?\
? ? ? ?static struct regulator_init_data _ldo##_data = { ? ? ? ? ? ? ? \
--
1.7.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-next" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#6 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0 (linux-next)

"regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. Update them to use the new dev_name entries instead.

---

[v2: replace dev with dev_name instead of just deleting dev.
Note however there is dev_name overlap; not sure if that matters? ]

arch/arm/mach-pxa/em-x270.c +5 -5
index c1b65da..0ffc100 100644
@@ -1083,19 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
 }
 
 /* DA9030 related initializations */
-#define REGULATOR_CONSUMER(_name, _dev, _supply)			       \
+#define REGULATOR_CONSUMER(_name, _dev_name, _supply)		        \
 	static struct regulator_consumer_supply _name##_consumers[] = {	\
 		{							\
-			.dev = _dev,					\
+			.dev_name = _dev_name,				\
 			.supply = _supply,				\
 		},							\
 	}
 
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");
 REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
+REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
 REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");
 REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
 
 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask)		\
Signature · 1 line
1.7.9.1
#7 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Hi Paul,

I've finally found one of em-x270 to test on...

Quoted 25 lines · Paul Gortmaker

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0 (linux-next)

"regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. Update them to use the new dev_name entries instead.

---

[v2: replace dev with dev_name instead of just deleting dev.
Note however there is dev_name overlap; not sure if that matters? ]

arch/arm/mach-pxa/em-x270.c +1 -1
index c1b65da..0ffc100 100644
@@ -1083,19 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
 }
 
 /* DA9030 related initializations */
-#define REGULATOR_CONSUMER(_name, _dev, _supply)			       \
+#define REGULATOR_CONSUMER(_name, _dev_name, _supply)		        \

arch/arm/mach-pxa/em-x270.c static void __init em_x270_userspace_consumers_init(void) · line 1094

Quoted 10 lines
arch/arm/mach-pxa/em-x270.c +2 -2
 	static struct regulator_consumer_supply _name##_consumers[] = {	\
 		{							\
-			.dev = _dev,					\
+			.dev_name = _dev_name,				\
 			.supply = _supply,				\
 		},							\
 	}
 
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");

If you make this:
REGULATOR_CONSUMER(ldo3, NULL, "vcc gps");

arch/arm/mach-pxa/em-x270.c static void __init em_x270_userspace_consumers_init(void) · line 1098

Quoted 6 lines
arch/arm/mach-pxa/em-x270.c +2 -2
 REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
+REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
 REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");

and this:
REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");

the device even boots...

arch/arm/mach-pxa/em-x270.c static void __init em_x270_userspace_consumers_init(void) · line 1101

Quoted 3 lines
arch/arm/mach-pxa/em-x270.c +0 -0
 REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
 
 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask)		\

Thanks for the patch, with the changes above:

Haojian, can this patch be included in your pull request (or another one)? It fixes the build for em_x270_defconfig and with the updates above gets the board to boot.

Thanks.

Signature · 2 lines
Regards,
Igor.
#8 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 11 lines · Igor Grinberg
Quoted 1 line · Paul Gortmaker

+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");

If you make this:
REGULATOR_CONSUMER(ldo3, NULL, "vcc gps");

Quoted 1 line

+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");

and this:
REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");

These don't look like good fixes, you should be specifying the
dev_name() for the consumer device? Presumably it's two separate
consumers and should be .0 and .1 or something?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120328/a0bf5a90/attachment-0001.sig>

maintainer
#9 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 8 lines · Mark Brown
Quoted 6 lines · Igor Grinberg
Quoted 1 line · Paul Gortmaker

+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");

If you make this:
REGULATOR_CONSUMER(ldo3, NULL, "vcc gps");

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");

and this:
REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");

These don't look like good fixes, you should be specifying the dev_name() for the consumer device? ?Presumably it's two separate consumers and should be .0 and .1 or something?

Paul,

Could you do a quick update on dev_name() according to Mark's comment?

-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); +REGULAOTR_CONSUMER(ldo10, dev_name(&pxa_device_mci.dev), "vcc sdio");

Best Regards
Haojian

#10 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Review

Quoted 10 lines · Haojian Zhuang

On Wed, Mar 28, 2012 at 11:27 PM, Mark Brown

Quoted 3 lines

These don't look like good fixes, you should be specifying the dev_name() for the consumer device? ?Presumably it's two separate consumers and should be .0 and .1 or something?

Could you do a quick update on dev_name() according to Mark's comment?

(quoted diff) +1 -1
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
+REGULAOTR_CONSUMER(ldo10, dev_name(&pxa_device_mci.dev), "vcc sdio");

No, you're missing the point again. As I said previously the whole
point of this interface is that you don't have to have access to the
struct device. This should be the string *returned* by dev_name(), not
a direct call to dev_name().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120328/7ab84218/attachment.sig>

#11 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

In reply to Mark Brown
Quoted 8 lines · Mark Brown
Quoted 6 lines · Igor Grinberg
Quoted 1 line · Paul Gortmaker

+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");

If you make this:
REGULATOR_CONSUMER(ldo3, NULL, "vcc gps");

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");

and this:
REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");

These don't look like good fixes, you should be specifying the dev_name() for the consumer device? Presumably it's two separate consumers and should be .0 and .1 or something?

Here is what I meant when I said in my v2 comment that there was naming overlap, and that I wasn't sure what impact that had.

The two consumers are:

static struct platform_device em_x270_gps_userspace_consumer = {
        .name           = "reg-userspace-consumer",
        .id             = 0,
        .dev            = {
                .platform_data = &em_x270_gps_consumer_data,
        },
};

and

static struct platform_device em_x270_gprs_userspace_consumer = {
        .name           = "reg-userspace-consumer",
        .id             = 1,
        .dev            = {
                .platform_data = &em_x270_gprs_consumer_data,
        }
};

Note that the existing names currently don't incorporate the .id field as a suffix, and so never were unique.

Paul.

#12 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 6 lines · Paul Gortmaker

On 12-03-28 11:27 AM, Mark Brown wrote:

static struct platform_device em_x270_gps_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 0,

Quoted 6 lines

static struct platform_device em_x270_gprs_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 1,

Note that the existing names currently don't incorporate the .id field as a suffix, and so never were unique.

No, this is just a basic part of how platform devices work - the device
name is always the same and if you've got more than one of them they get
different .ids. dev_name() returns name.id, or just name if id is set
to -1 indicating that there's onyl one device of a given type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120328/6c767616/attachment.sig>

#13 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 11 lines · Mark Brown
Quoted 9 lines · Paul Gortmaker

On 12-03-28 11:27 AM, Mark Brown wrote:

static struct platform_device em_x270_gps_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 0,

static struct platform_device em_x270_gprs_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 1,

Quoted 7 lines
Quoted 2 lines

Note that the existing names currently don't incorporate the .id field as a suffix, and so never were unique.

No, this is just a basic part of how platform devices work - the device name is always the same and if you've got more than one of them they get different .ids. dev_name() returns name.id, or just name if id is set to -1 indicating that there's onyl one device of a given type.

OK, so Igor - can you simply retest the v2 patch, but make the two trivial changes:

-REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps"); +REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");

-REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs"); +REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");

Thanks,
Paul.

#14 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 23 lines · Paul Gortmaker
Quoted 11 lines · Mark Brown
Quoted 9 lines · Paul Gortmaker

On 12-03-28 11:27 AM, Mark Brown wrote:

static struct platform_device em_x270_gps_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 0,

static struct platform_device em_x270_gprs_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 1,

Quoted 7 lines
Quoted 2 lines

Note that the existing names currently don't incorporate the .id field as a suffix, and so never were unique.

No, this is just a basic part of how platform devices work - the device name is always the same and if you've got more than one of them they get different .ids. dev_name() returns name.id, or just name if id is set to -1 indicating that there's onyl one device of a given type.

OK, so Igor - can you simply retest the v2 patch, but make the two trivial changes:

Review

Quoted 5 lines
(quoted diff) +2 -2
-REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
 
-REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");

Well, I thought of this solution, but I don't like it, as it makes the whole thing very fragile and sensitive to the reg-userspace-consumer platform device registration order and count, isn't it? (That's why I proposed to use NULL...).

So, Mark, how do you think the above issues can be handled without putting NULL into the dev_name?

Signature · 2 lines
Regards,
Igor.
#15 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 10 lines · Igor Grinberg
Quoted 7 lines · Paul Gortmaker
Quoted 7 lines
Quoted 7 lines

static struct platform_device em_x270_gps_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 0,

static struct platform_device em_x270_gprs_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 1,

Quoted 7 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");

Well, I thought of this solution, but I don't like it, as it makes the whole thing very fragile and sensitive to the reg-userspace-consumer platform device registration order and count, isn't it? (That's why I proposed to use NULL...).

No the platform device numbering should be totally stable for a given board unless someone deliberately sets out to renumber them - the .ids are explicitly assigned by the board when it registers the device.

Quoted 2 lines

So, Mark, how do you think the above issues can be handled without putting NULL into the dev_name?

It shouldn't be a problem I think.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120329/c6b5b0e9/attachment.sig>

#16 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 19 lines · Mark Brown
Quoted 10 lines · Igor Grinberg
Quoted 7 lines · Paul Gortmaker
Quoted 7 lines
Quoted 7 lines

static struct platform_device em_x270_gps_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 0,

static struct platform_device em_x270_gprs_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 1,

Quoted 7 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");

Well, I thought of this solution, but I don't like it, as it makes the whole thing very fragile and sensitive to the reg-userspace-consumer platform device registration order and count, isn't it? (That's why I proposed to use NULL...).

Quoted 8 lines

No the platform device numbering should be totally stable for a given board unless someone deliberately sets out to renumber them - the .ids are explicitly assigned by the board when it registers the device.

Quoted 2 lines

So, Mark, how do you think the above issues can be handled without putting NULL into the dev_name?

It shouldn't be a problem I think.

Mark,

Would you like me to send a v3 with the .0 and .1 added, or are you OK with making that small change to v2 yourself?

Paul.

#17 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 2 lines · Paul Gortmaker

Would you like me to send a v3 with the .0 and .1 added, or are you OK with making that small change to v2 yourself?

Please resend, makes life easier. I'm not sure if it's me or Haojin
who will end up applying the change anyway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120329/76f74b6c/attachment.sig>

#18 lore raw

PATCH v3 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0

"regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. Map it onto dev_name appropriately

Since there are two consumers with the name "reg-userspace-consumer", we have to supply the ID as a suffix in the REGULATOR_CONSUMER calls.

---

[v3: add .0/.1 ID suffix to "reg-userspace-consumer" instances ]

arch/arm/mach-pxa/em-x270.c +5 -5
index c1b65da..16ec557 100644
@@ -1083,19 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
 }
 
 /* DA9030 related initializations */
-#define REGULATOR_CONSUMER(_name, _dev, _supply)			       \
+#define REGULATOR_CONSUMER(_name, _dev_name, _supply)		        \
 	static struct regulator_consumer_supply _name##_consumers[] = {	\
 		{							\
-			.dev = _dev,					\
+			.dev_name = _dev_name,				\
 			.supply = _supply,				\
 		},							\
 	}
 
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
 REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
+REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
 REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");
 REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
 
 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask)		\
Signature · 1 line
1.7.9.1
maintainer Applied
#19 lore raw

PATCH v3 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 44 lines · Paul Gortmaker

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0

?"regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. ?Map it onto dev_name appropriately

Since there are two consumers with the name "reg-userspace-consumer", we have to supply the ID as a suffix in the REGULATOR_CONSUMER calls.

---

[v3: add .0/.1 ID suffix to "reg-userspace-consumer" instances ]

arch/arm/mach-pxa/em-x270.c +0 -0
index c1b65da..16ec557 100644
@@ -1083,19 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
 ?}
 

?/* DA9030 related initializations */

arch/arm/mach-pxa/em-x270.c +1 -1
-#define REGULATOR_CONSUMER(_name, _dev, _supply) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
+#define REGULATOR_CONSUMER(_name, _dev_name, _supply) ? ? ? ? ? ? ? ? ?\

? ? ? ?static struct regulator_consumer_supply _name##_consumers[] = { \
? ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
- ? ? ? ? ? ? ? ? ? ? ? .dev = _dev, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? .dev_name = _dev_name, ? ? ? ? ? ? ? ? ? ? ? ? ?\
? ? ? ? ? ? ? ? ? ? ? ?.supply = _supply, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
? ? ? ? ? ? ? ?}, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
? ? ? ?}

arch/arm/mach-pxa/em-x270.c +1 -1
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");

?REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");

arch/arm/mach-pxa/em-x270.c +1 -1
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
+REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");

?REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");

arch/arm/mach-pxa/em-x270.c +1 -1
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");

?REGULATOR_CONSUMER(buck2, NULL, "vcc_core");

Quoted 4 lines

?#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) ? ? ? ? ? ? ?\
--
1.7.9.1

Applied

Thanks
Haojian

#20 lore raw

PATCH v3 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

In reply to Paul Gortmaker
Quoted 35 lines · Paul Gortmaker

Commit 737f360d5bef5e01c6cfa755dca0b449a154c1e0

"regulator: Remove support for supplies specified by struct device"

caused this file to break, since it was still relying on the device field to be present. Map it onto dev_name appropriately

Since there are two consumers with the name "reg-userspace-consumer", we have to supply the ID as a suffix in the REGULATOR_CONSUMER calls.

---

[v3: add .0/.1 ID suffix to "reg-userspace-consumer" instances ]

arch/arm/mach-pxa/em-x270.c +2 -3
index c1b65da..16ec557 100644
@@ -1083,19 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
 }
 
 /* DA9030 related initializations */
-#define REGULATOR_CONSUMER(_name, _dev, _supply)			       \
+#define REGULATOR_CONSUMER(_name, _dev_name, _supply)		        \
 	static struct regulator_consumer_supply _name##_consumers[] = {	\
 		{							\
-			.dev = _dev,					\
+			.dev_name = _dev_name,				\
 			.supply = _supply,				\
 		},							\
 	}
 
-REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");

arch/arm/mach-pxa/em-x270.c static void __init em_x270_userspace_consumers_init(void) · line 1101

Quoted 10 lines
arch/arm/mach-pxa/em-x270.c +3 -2
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
 REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
+REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
 REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");
 REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
 
 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask)		\

Better late then never...
Tested and works as expected.
Thanks for the patch.

Signature · 2 lines
Regards,
Igor.
#21 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

In reply to Igor Grinberg
Quoted 27 lines · Igor Grinberg
Quoted 26 lines · Paul Gortmaker
Quoted 11 lines · Mark Brown
Quoted 9 lines · Paul Gortmaker

On 12-03-28 11:27 AM, Mark Brown wrote:

static struct platform_device em_x270_gps_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 0,

static struct platform_device em_x270_gprs_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 1,

Quoted 7 lines
Quoted 2 lines

Note that the existing names currently don't incorporate the .id field as a suffix, and so never were unique.

No, this is just a basic part of how platform devices work - the device name is always the same and if you've got more than one of them they get different .ids. dev_name() returns name.id, or just name if id is set to -1 indicating that there's onyl one device of a given type.

OK, so Igor - can you simply retest the v2 patch, but make the two trivial changes:

(quoted diff) +1 -1
-REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");

Well, I thought of this solution, but I don't like it, as it makes the whole thing very fragile and sensitive to the reg-userspace-consumer platform device registration order and count, isn't it?

Why would it be order dependent? You can see in the above structs that they explicitly call out an ID value -- it is _not_ chosen at the time of registration. So it will always be:

reg-userspace-consumer.0  -->  gps consumer
reg-userspace-consumer.1  -->  gprs consumer

At least that is my (limited) understanding, based on what Mark was saying.

Paul.
--

Quoted 5 lines

(That's why I proposed to use NULL...).

So, Mark, how do you think the above issues can be handled without putting NULL into the dev_name?

#22 lore raw

PATCH 1/1 ARM: pxa: fix build failure for regulator consumer in em-x270.c

Quoted 39 lines · Paul Gortmaker
Quoted 27 lines · Igor Grinberg
Quoted 26 lines · Paul Gortmaker
Quoted 11 lines · Mark Brown
Quoted 9 lines · Paul Gortmaker

On 12-03-28 11:27 AM, Mark Brown wrote:

static struct platform_device em_x270_gps_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 0,

static struct platform_device em_x270_gprs_userspace_consumer = {
.name = "reg-userspace-consumer",
.id = 1,

Quoted 7 lines
Quoted 2 lines

Note that the existing names currently don't incorporate the .id field as a suffix, and so never were unique.

No, this is just a basic part of how platform devices work - the device name is always the same and if you've got more than one of them they get different .ids. dev_name() returns name.id, or just name if id is set to -1 indicating that there's onyl one device of a given type.

OK, so Igor - can you simply retest the v2 patch, but make the two trivial changes:

(quoted diff) +1 -1
-REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer", "vcc gps");
+REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer", "vcc gprs");
+REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");

Well, I thought of this solution, but I don't like it, as it makes the whole thing very fragile and sensitive to the reg-userspace-consumer platform device registration order and count, isn't it?

Why would it be order dependent? You can see in the above structs that they explicitly call out an ID value -- it is _not_ chosen at the time of registration. So it will always be:

Quoted 5 lines
reg-userspace-consumer.0  -->  gps consumer
reg-userspace-consumer.1  -->  gprs consumer

At least that is my (limited) understanding, based on what Mark was saying.

The problem is, that someone has to stop sending emails in a hurry... Spitting all the mix in the head when in rush...
and that would be me...

Sorry, for the mess, I'll try to fix myself up...

Signature · 2 lines
Regards,
Igor.