linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: fix modular builds of rc5t583 regulator support
@ 2012-04-16  4:08 Paul Gortmaker
  2012-04-16  6:54 ` Laxman Dewangan
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Gortmaker @ 2012-04-16  4:08 UTC (permalink / raw)
  To: ldewangan; +Cc: sameo, broonie, linux-kernel, linux-next, Paul Gortmaker

The combination of commit 1b1247dd75aa5cf5fae54a3bec7280046e9c7957

    "mfd: Add support for RICOH PMIC RC5T583"

and commit 6ffc3270210efa2bea526953a142ffc908f5bd86

    "regulator: Add support for RICOH PMIC RC5T583 regulator"

are causing the i386 allmodconfig builds to fail with this:

  ERROR: "rc5t583_update" [drivers/regulator/rc5t583-regulator.ko] undefined!
  ERROR: "rc5t583_set_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
  ERROR: "rc5t583_clear_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
  ERROR: "rc5t583_read" [drivers/regulator/rc5t583-regulator.ko] undefined!

and this:

  ERROR: "rc5t583_ext_power_req_config" [drivers/regulator/rc5t583-regulator.ko] undefined!

For the 1st four, make the simple ops static inline, instead of
polluting the namespace with trivial exports.  For the last one,
add an EXPORT_SYMBOL.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---

[ alternately, make REGULATOR_RC5T583 bool instead of tristate? ]

diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
index 99ef944..44afae0 100644
--- a/drivers/mfd/rc5t583.c
+++ b/drivers/mfd/rc5t583.c
@@ -80,44 +80,6 @@ static struct mfd_cell rc5t583_subdevs[] = {
 	{.name = "rc5t583-key",      }
 };
 
-int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
-{
-	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
-	return regmap_write(rc5t583->regmap, reg, val);
-}
-
-int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val)
-{
-	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
-	unsigned int ival;
-	int ret;
-	ret = regmap_read(rc5t583->regmap, reg, &ival);
-	if (!ret)
-		*val = (uint8_t)ival;
-	return ret;
-}
-
-int rc5t583_set_bits(struct device *dev, unsigned int reg,
-			unsigned int bit_mask)
-{
-	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
-	return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask);
-}
-
-int rc5t583_clear_bits(struct device *dev, unsigned int reg,
-			unsigned int bit_mask)
-{
-	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
-	return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0);
-}
-
-int rc5t583_update(struct device *dev, unsigned int reg,
-		unsigned int val, unsigned int mask)
-{
-	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
-	return regmap_update_bits(rc5t583->regmap, reg, mask, val);
-}
-
 static int __rc5t583_set_ext_pwrreq1_control(struct device *dev,
 	int id, int ext_pwr, int slots)
 {
@@ -197,6 +159,7 @@ int rc5t583_ext_power_req_config(struct device *dev, int ds_id,
 			ds_id, ext_pwr_req);
 	return 0;
 }
+EXPORT_SYMBOL(rc5t583_ext_power_req_config);
 
 static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583,
 	struct rc5t583_platform_data *pdata)
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index b2c1f44..c42fe92 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -26,6 +26,7 @@
 
 #include <linux/mutex.h>
 #include <linux/types.h>
+#include <linux/regmap.h>
 
 #define RC5T583_MAX_REGS		0xF8
 
@@ -308,14 +309,44 @@ struct rc5t583_platform_data {
 	struct regulator_init_data *reg_init_data[RC5T583_REGULATOR_MAX];
 };
 
-int rc5t583_write(struct device *dev, u8 reg, uint8_t val);
-int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val);
-int rc5t583_set_bits(struct device *dev, unsigned int reg,
-		unsigned int bit_mask);
-int rc5t583_clear_bits(struct device *dev, unsigned int reg,
-		unsigned int bit_mask);
-int rc5t583_update(struct device *dev, unsigned int reg,
-		unsigned int val, unsigned int mask);
+static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
+{
+	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
+	return regmap_write(rc5t583->regmap, reg, val);
+}
+
+static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val)
+{
+	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
+	unsigned int ival;
+	int ret;
+	ret = regmap_read(rc5t583->regmap, reg, &ival);
+	if (!ret)
+		*val = (uint8_t)ival;
+	return ret;
+}
+
+static inline int rc5t583_set_bits(struct device *dev, unsigned int reg,
+			unsigned int bit_mask)
+{
+	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
+	return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask);
+}
+
+static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg,
+			unsigned int bit_mask)
+{
+	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
+	return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0);
+}
+
+static inline int rc5t583_update(struct device *dev, unsigned int reg,
+		unsigned int val, unsigned int mask)
+{
+	struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
+	return regmap_update_bits(rc5t583->regmap, reg, mask, val);
+}
+
 int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
 	int ext_pwr_req, int deepsleep_slot_nr);
 int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
-- 
1.7.9.1

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

* Re: [PATCH] mfd: fix modular builds of rc5t583 regulator support
  2012-04-16  4:08 [PATCH] mfd: fix modular builds of rc5t583 regulator support Paul Gortmaker
@ 2012-04-16  6:54 ` Laxman Dewangan
  2012-04-16 14:12   ` Paul Gortmaker
  0 siblings, 1 reply; 5+ messages in thread
From: Laxman Dewangan @ 2012-04-16  6:54 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: sameo, broonie, linux-kernel, linux-next

On Monday 16 April 2012 09:38 AM, Paul Gortmaker wrote:
> The combination of commit 1b1247dd75aa5cf5fae54a3bec7280046e9c7957
>
>      "mfd: Add support for RICOH PMIC RC5T583"
>
> and commit 6ffc3270210efa2bea526953a142ffc908f5bd86
>
>      "regulator: Add support for RICOH PMIC RC5T583 regulator"
>
> are causing the i386 allmodconfig builds to fail with this:
>
>    ERROR: "rc5t583_update" [drivers/regulator/rc5t583-regulator.ko] undefined!
>    ERROR: "rc5t583_set_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
>    ERROR: "rc5t583_clear_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
>    ERROR: "rc5t583_read" [drivers/regulator/rc5t583-regulator.ko] undefined!
>
> and this:
>
>    ERROR: "rc5t583_ext_power_req_config" [drivers/regulator/rc5t583-regulator.ko] undefined!
>
> For the 1st four, make the simple ops static inline, instead of
> polluting the namespace with trivial exports.  For the last one,
> add an EXPORT_SYMBOL.
>
> Signed-off-by: Paul Gortmaker<paul.gortmaker@windriver.com>
> ---
>
> [ alternately, make REGULATOR_RC5T583 bool instead of tristate? ]

Why not export all require symbol from mfd core.
I am sending the patch to exporting all required apis. Please review.

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

* Re: [PATCH] mfd: fix modular builds of rc5t583 regulator support
  2012-04-16 14:12   ` Paul Gortmaker
@ 2012-04-16 14:02     ` Laxman Dewangan
  2012-04-16 19:26     ` Samuel Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Laxman Dewangan @ 2012-04-16 14:02 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: sameo, broonie, linux-kernel, linux-next

On Monday 16 April 2012 07:42 PM, Paul Gortmaker wrote:
> On 12-04-16 02:54 AM, Laxman Dewangan wrote:
>> On Monday 16 April 2012 09:38 AM, Paul Gortmaker wrote:
>>
> As I said in the commit log, it doesn't seem to make sense to export
> them when they are trivial enough to be static inline, since it
> avoids having them pollute the /proc/kallsyms namespace.
>
> It is almost like having basic inb/outb as functions vs inline; it
> just doesn't make sense to me.
>
> However, if you are determined to rewrite the patch in another way,
> please add the customary reported-by line.
>

I am fine on either way i.e. inline or exporting symbols only.

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

* Re: [PATCH] mfd: fix modular builds of rc5t583 regulator support
  2012-04-16  6:54 ` Laxman Dewangan
@ 2012-04-16 14:12   ` Paul Gortmaker
  2012-04-16 14:02     ` Laxman Dewangan
  2012-04-16 19:26     ` Samuel Ortiz
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Gortmaker @ 2012-04-16 14:12 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: sameo, broonie, linux-kernel, linux-next

On 12-04-16 02:54 AM, Laxman Dewangan wrote:
> On Monday 16 April 2012 09:38 AM, Paul Gortmaker wrote:
>> The combination of commit 1b1247dd75aa5cf5fae54a3bec7280046e9c7957
>>
>>      "mfd: Add support for RICOH PMIC RC5T583"
>>
>> and commit 6ffc3270210efa2bea526953a142ffc908f5bd86
>>
>>      "regulator: Add support for RICOH PMIC RC5T583 regulator"
>>
>> are causing the i386 allmodconfig builds to fail with this:
>>
>>    ERROR: "rc5t583_update" [drivers/regulator/rc5t583-regulator.ko] undefined!
>>    ERROR: "rc5t583_set_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
>>    ERROR: "rc5t583_clear_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
>>    ERROR: "rc5t583_read" [drivers/regulator/rc5t583-regulator.ko] undefined!
>>
>> and this:
>>
>>    ERROR: "rc5t583_ext_power_req_config" [drivers/regulator/rc5t583-regulator.ko] undefined!
>>
>> For the 1st four, make the simple ops static inline, instead of
>> polluting the namespace with trivial exports.  For the last one,
>> add an EXPORT_SYMBOL.
>>
>> Signed-off-by: Paul Gortmaker<paul.gortmaker@windriver.com>
>> ---
>>
>> [ alternately, make REGULATOR_RC5T583 bool instead of tristate? ]
> 
> Why not export all require symbol from mfd core.
> I am sending the patch to exporting all required apis. Please review.

As I said in the commit log, it doesn't seem to make sense to export
them when they are trivial enough to be static inline, since it
avoids having them pollute the /proc/kallsyms namespace.

It is almost like having basic inb/outb as functions vs inline; it
just doesn't make sense to me.

However, if you are determined to rewrite the patch in another way,
please add the customary reported-by line.

Thanks,
Paul.

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

* Re: [PATCH] mfd: fix modular builds of rc5t583 regulator support
  2012-04-16 14:12   ` Paul Gortmaker
  2012-04-16 14:02     ` Laxman Dewangan
@ 2012-04-16 19:26     ` Samuel Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2012-04-16 19:26 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Laxman Dewangan, broonie, linux-kernel, linux-next

Hi Paul, Laxman,

On Mon, Apr 16, 2012 at 10:12:21AM -0400, Paul Gortmaker wrote:
> On 12-04-16 02:54 AM, Laxman Dewangan wrote:
> > On Monday 16 April 2012 09:38 AM, Paul Gortmaker wrote:
> >> The combination of commit 1b1247dd75aa5cf5fae54a3bec7280046e9c7957
> >>
> >>      "mfd: Add support for RICOH PMIC RC5T583"
> >>
> >> and commit 6ffc3270210efa2bea526953a142ffc908f5bd86
> >>
> >>      "regulator: Add support for RICOH PMIC RC5T583 regulator"
> >>
> >> are causing the i386 allmodconfig builds to fail with this:
> >>
> >>    ERROR: "rc5t583_update" [drivers/regulator/rc5t583-regulator.ko] undefined!
> >>    ERROR: "rc5t583_set_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
> >>    ERROR: "rc5t583_clear_bits" [drivers/regulator/rc5t583-regulator.ko] undefined!
> >>    ERROR: "rc5t583_read" [drivers/regulator/rc5t583-regulator.ko] undefined!
> >>
> >> and this:
> >>
> >>    ERROR: "rc5t583_ext_power_req_config" [drivers/regulator/rc5t583-regulator.ko] undefined!
> >>
> >> For the 1st four, make the simple ops static inline, instead of
> >> polluting the namespace with trivial exports.  For the last one,
> >> add an EXPORT_SYMBOL.
> >>
> >> Signed-off-by: Paul Gortmaker<paul.gortmaker@windriver.com>
> >> ---
> >>
> >> [ alternately, make REGULATOR_RC5T583 bool instead of tristate? ]
> > 
> > Why not export all require symbol from mfd core.
> > I am sending the patch to exporting all required apis. Please review.
> 
> As I said in the commit log, it doesn't seem to make sense to export
> them when they are trivial enough to be static inline, since it
> avoids having them pollute the /proc/kallsyms namespace.
I'm applying Paul's patch to my for-linus branch, thanks guys.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2012-04-16 19:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-16  4:08 [PATCH] mfd: fix modular builds of rc5t583 regulator support Paul Gortmaker
2012-04-16  6:54 ` Laxman Dewangan
2012-04-16 14:12   ` Paul Gortmaker
2012-04-16 14:02     ` Laxman Dewangan
2012-04-16 19:26     ` Samuel Ortiz

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).