linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: core: Fix build error due to const qualifier for ops
@ 2014-08-18  2:34 Axel Lin
  2014-08-18 13:06 ` Guodong Xu
  2014-08-18 14:10 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2014-08-18  2:34 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Guodong Xu, Stephen Rothwell, linux-kernel@vger.kernel.org

Drop const qualifier for ops of struct regulator_desc.
Allow regulator drivers to update ops before registering regulator.

Fix below build error:
  CC [M]  drivers/regulator/mc13892-regulator.o
drivers/regulator/mc13892-regulator.c: In function 'mc13892_regulator_probe':
drivers/regulator/mc13892-regulator.c:586:3: error: assignment of member 'set_mode' in read-only object
drivers/regulator/mc13892-regulator.c:588:3: error: assignment of member 'get_mode' in read-only object
make[2]: *** [drivers/regulator/mc13892-regulator.o] Error 1
make[1]: *** [drivers/regulator] Error 2
make: *** [drivers] Error 2

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 include/linux/regulator/driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index efe058f..3abda75 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -246,7 +246,7 @@ struct regulator_desc {
 	int id;
 	bool continuous_voltage_range;
 	unsigned n_voltages;
-	const struct regulator_ops *ops;
+	struct regulator_ops *ops;
 	int irq;
 	enum regulator_type type;
 	struct module *owner;
-- 
1.9.1




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

* Re: [PATCH] regulator: core: Fix build error due to const qualifier for ops
  2014-08-18  2:34 [PATCH] regulator: core: Fix build error due to const qualifier for ops Axel Lin
@ 2014-08-18 13:06 ` Guodong Xu
  2014-08-18 14:10 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Guodong Xu @ 2014-08-18 13:06 UTC (permalink / raw)
  To: Axel Lin, Mark Brown, Liam Girdwood
  Cc: Stephen Rothwell, linux-kernel@vger.kernel.org

I'm sending a patch to fix the build error on mc13892-regulator.c

-Guodong

On 08/18/2014 10:34 AM, Axel Lin wrote:
> Drop const qualifier for ops of struct regulator_desc.
> Allow regulator drivers to update ops before registering regulator.
> 
> Fix below build error:
>   CC [M]  drivers/regulator/mc13892-regulator.o
> drivers/regulator/mc13892-regulator.c: In function 'mc13892_regulator_probe':
> drivers/regulator/mc13892-regulator.c:586:3: error: assignment of member 'set_mode' in read-only object
> drivers/regulator/mc13892-regulator.c:588:3: error: assignment of member 'get_mode' in read-only object
> make[2]: *** [drivers/regulator/mc13892-regulator.o] Error 1
> make[1]: *** [drivers/regulator] Error 2
> make: *** [drivers] Error 2
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  include/linux/regulator/driver.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
> index efe058f..3abda75 100644
> --- a/include/linux/regulator/driver.h
> +++ b/include/linux/regulator/driver.h
> @@ -246,7 +246,7 @@ struct regulator_desc {
>  	int id;
>  	bool continuous_voltage_range;
>  	unsigned n_voltages;
> -	const struct regulator_ops *ops;
> +	struct regulator_ops *ops;
>  	int irq;
>  	enum regulator_type type;
>  	struct module *owner;
> 

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

* Re: [PATCH] regulator: core: Fix build error due to const qualifier for ops
  2014-08-18  2:34 [PATCH] regulator: core: Fix build error due to const qualifier for ops Axel Lin
  2014-08-18 13:06 ` Guodong Xu
@ 2014-08-18 14:10 ` Mark Brown
  2014-08-20  2:51   ` Axel Lin
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2014-08-18 14:10 UTC (permalink / raw)
  To: Axel Lin
  Cc: Liam Girdwood, Guodong Xu, Stephen Rothwell,
	linux-kernel@vger.kernel.org

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

On Mon, Aug 18, 2014 at 10:34:08AM +0800, Axel Lin wrote:
> Drop const qualifier for ops of struct regulator_desc.
> Allow regulator drivers to update ops before registering regulator.

Applied, thanks.

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

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

* Re: [PATCH] regulator: core: Fix build error due to const qualifier for ops
  2014-08-18 14:10 ` Mark Brown
@ 2014-08-20  2:51   ` Axel Lin
  2014-08-20 15:17     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2014-08-20  2:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Guodong Xu, Stephen Rothwell,
	linux-kernel@vger.kernel.org

2014-08-18 22:10 GMT+08:00 Mark Brown <broonie@kernel.org>:
> On Mon, Aug 18, 2014 at 10:34:08AM +0800, Axel Lin wrote:
>> Drop const qualifier for ops of struct regulator_desc.
>> Allow regulator drivers to update ops before registering regulator.
>
> Applied, thanks.

Hi Mark,
I found this commit is applied and I got below build warning in your for-next
tree.

  CC [M]  drivers/regulator/hi6421-regulator.o
drivers/regulator/hi6421-regulator.c:356:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:358:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:360:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:362:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:364:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:366:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:368:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:370:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:372:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:374:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:376:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:378:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:380:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:382:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:384:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:386:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:388:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:390:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:392:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:394:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:396:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:398:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:400:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:401:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:402:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:403:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:405:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]
drivers/regulator/hi6421-regulator.c:407:2: warning: initialization
discards 'const' qualifier from pointer target type [enabled by
default]

As I mentioned in the commit log:
    Drop const qualifier for ops of struct regulator_desc.
    Allow regulator drivers to update ops before registering regulator.
    So I don't think it's necessary to add const for ops in struct
regulator_desc.
    (I think the original point was the "regulator core" won't modify the ops).

The fix is either drop the 'const' qualifier in hi6421-regulator driver or
add back const qualifier for ops of struct regulator_desc in
include/linux/regulator/driver.h.
Which one do you prefer?

Thanks,
Axel

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

* Re: [PATCH] regulator: core: Fix build error due to const qualifier for ops
  2014-08-20  2:51   ` Axel Lin
@ 2014-08-20 15:17     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-08-20 15:17 UTC (permalink / raw)
  To: Axel Lin
  Cc: Liam Girdwood, Guodong Xu, Stephen Rothwell,
	linux-kernel@vger.kernel.org

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

On Wed, Aug 20, 2014 at 10:51:33AM +0800, Axel Lin wrote:

> As I mentioned in the commit log:
>     Drop const qualifier for ops of struct regulator_desc.
>     Allow regulator drivers to update ops before registering regulator.
>     So I don't think it's necessary to add const for ops in struct
> regulator_desc.
>     (I think the original point was the "regulator core" won't modify the ops).

> The fix is either drop the 'const' qualifier in hi6421-regulator driver or
> add back const qualifier for ops of struct regulator_desc in
> include/linux/regulator/driver.h.
> Which one do you prefer?

Adding back the const qualifier.

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

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

end of thread, other threads:[~2014-08-20 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-18  2:34 [PATCH] regulator: core: Fix build error due to const qualifier for ops Axel Lin
2014-08-18 13:06 ` Guodong Xu
2014-08-18 14:10 ` Mark Brown
2014-08-20  2:51   ` Axel Lin
2014-08-20 15:17     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).