Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1683430 > unrolled thread

[PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case

Started bysathyanarayanan.kuppuswamy@linux.intel.com
First post2017-07-07 23:50 +0200
Last post2017-07-09 01:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case sathyanarayanan.kuppuswamy@linux.intel.com - 2017-07-07 23:50 +0200
    Re: [PATCH v1 1/1] mux: consumer: Add dummy functions for  !CONFIG_MULTIPLEXER case "Kuppuswamy, Sathyanarayanan" <sathyaosid@gmail.com> - 2017-07-09 01:10 +0200

#1683430 — [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case

Fromsathyanarayanan.kuppuswamy@linux.intel.com
Date2017-07-07 23:50 +0200
Subject[PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case
Message-ID<u0Jip-1sx-1@gated-at.bofh.it>
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

Add dummy functions to avoid compile time issues when CONFIG_MULTIPLEXER
is not enabled.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 include/linux/mux/consumer.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/include/linux/mux/consumer.h b/include/linux/mux/consumer.h
index 5577e1b..744a5b8 100644
--- a/include/linux/mux/consumer.h
+++ b/include/linux/mux/consumer.h
@@ -16,6 +16,7 @@
 struct device;
 struct mux_control;
 
+#ifdef CONFIG_MULTIPLEXER
 unsigned int mux_control_states(struct mux_control *mux);
 int __must_check mux_control_select(struct mux_control *mux,
 				    unsigned int state);
@@ -29,4 +30,41 @@ void mux_control_put(struct mux_control *mux);
 struct mux_control *devm_mux_control_get(struct device *dev,
 					 const char *mux_name);
 
+#else
+unsigned int mux_control_states(struct mux_control *mux)
+{
+	return -ENODEV;
+}
+
+int __must_check mux_control_select(struct mux_control *mux,
+				    unsigned int state)
+{
+	return -ENODEV;
+}
+
+int __must_check mux_control_try_select(struct mux_control *mux,
+					unsigned int state)
+{
+	return -ENODEV;
+}
+
+int mux_control_deselect(struct mux_control *mux)
+{
+	return -ENODEV;
+}
+
+struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+void mux_control_put(struct mux_control *mux) {}
+
+struct mux_control *devm_mux_control_get(struct device *dev,
+					 const char *mux_name)
+{
+	return ERR_PTR(-ENODEV);
+}
+#endif
+
 #endif /* _LINUX_MUX_CONSUMER_H */
-- 
2.7.4

[toc] | [next] | [standalone]


#1683671 — Re: [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case

From"Kuppuswamy, Sathyanarayanan" <sathyaosid@gmail.com>
Date2017-07-09 01:10 +0200
SubjectRe: [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case
Message-ID<u171o-8py-9@gated-at.bofh.it>
In reply to#1683430
Hi Peter,

On 7/8/2017 1:55 PM, Peter Rosin wrote:
> On 2017-07-07 23:41, sathyanarayanan.kuppuswamy@linux.intel.com wrote:
>> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>>
>> Add dummy functions to avoid compile time issues when CONFIG_MULTIPLEXER
>> is not enabled.
> Hi!
>
> Consumers should "select MULTIPLEXER",
  If their driver can't work without mux_* calls then  you can make it 
compulsory. But its not always true.
>   so this does not make sense.
> Or do you have a driver that has an optional mux consumer?
I came across this case when I was working on Intel USB MUX driver. I 
think you know the history behind it. Although I am not planning to 
merge that driver now, but I think the use case is still valid.
>
>> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>> ---
>>   include/linux/mux/consumer.h | 38 ++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 38 insertions(+)
>>
>> diff --git a/include/linux/mux/consumer.h b/include/linux/mux/consumer.h
>> index 5577e1b..744a5b8 100644
>> --- a/include/linux/mux/consumer.h
>> +++ b/include/linux/mux/consumer.h
>> @@ -16,6 +16,7 @@
>>   struct device;
>>   struct mux_control;
>>   
>> +#ifdef CONFIG_MULTIPLEXER
>>   unsigned int mux_control_states(struct mux_control *mux);
>>   int __must_check mux_control_select(struct mux_control *mux,
>>   				    unsigned int state);
>> @@ -29,4 +30,41 @@ void mux_control_put(struct mux_control *mux);
>>   struct mux_control *devm_mux_control_get(struct device *dev,
>>   					 const char *mux_name);
>>   
>> +#else
>> +unsigned int mux_control_states(struct mux_control *mux)
> static inline
>
> Cheers,
> peda
>
>> +{
>> +	return -ENODEV;
>> +}
>> +
>> +int __must_check mux_control_select(struct mux_control *mux,
>> +				    unsigned int state)
>> +{
>> +	return -ENODEV;
>> +}
>> +
>> +int __must_check mux_control_try_select(struct mux_control *mux,
>> +					unsigned int state)
>> +{
>> +	return -ENODEV;
>> +}
>> +
>> +int mux_control_deselect(struct mux_control *mux)
>> +{
>> +	return -ENODEV;
>> +}
>> +
>> +struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
>> +{
>> +	return ERR_PTR(-ENODEV);
>> +}
>> +
>> +void mux_control_put(struct mux_control *mux) {}
>> +
>> +struct mux_control *devm_mux_control_get(struct device *dev,
>> +					 const char *mux_name)
>> +{
>> +	return ERR_PTR(-ENODEV);
>> +}
>> +#endif
>> +
>>   #endif /* _LINUX_MUX_CONSUMER_H */
>>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web