linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case
@ 2017-07-07 21:41 sathyanarayanan.kuppuswamy
  2017-07-08 15:32 ` kbuild test robot
  2017-07-08 20:55 ` Peter Rosin
  0 siblings, 2 replies; 5+ messages in thread
From: sathyanarayanan.kuppuswamy @ 2017-07-07 21:41 UTC (permalink / raw)
  To: peda; +Cc: linux-kernel, sathyaosid, Kuppuswamy Sathyanarayanan

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

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

* Re: [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case
  2017-07-07 21:41 [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case sathyanarayanan.kuppuswamy
@ 2017-07-08 15:32 ` kbuild test robot
  2017-07-08 20:55 ` Peter Rosin
  1 sibling, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-07-08 15:32 UTC (permalink / raw)
  To: sathyanarayanan.kuppuswamy
  Cc: kbuild-all, peda, linux-kernel, sathyaosid, Kuppuswamy Sathyanarayanan

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

Hi Kuppuswamy,

[auto build test ERROR on linus/master]
[also build test ERROR on next-20170707]
[cannot apply to v4.12]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/sathyanarayanan-kuppuswamy-linux-intel-com/mux-consumer-Add-dummy-functions-for-CONFIG_MULTIPLEXER-case/20170708-194501
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> drivers/mux/mux-core.c:290:14: error: redefinition of 'mux_control_states'
    unsigned int mux_control_states(struct mux_control *mux)
                 ^~~~~~~~~~~~~~~~~~
   In file included from drivers/mux/mux-core.c:21:0:
   include/linux/mux/consumer.h:34:14: note: previous definition of 'mux_control_states' was here
    unsigned int mux_control_states(struct mux_control *mux)
                 ^~~~~~~~~~~~~~~~~~
>> drivers/mux/mux-core.c:337:5: error: redefinition of 'mux_control_select'
    int mux_control_select(struct mux_control *mux, unsigned int state)
        ^~~~~~~~~~~~~~~~~~
   In file included from drivers/mux/mux-core.c:21:0:
   include/linux/mux/consumer.h:39:18: note: previous definition of 'mux_control_select' was here
    int __must_check mux_control_select(struct mux_control *mux,
                     ^~~~~~~~~~~~~~~~~~
>> drivers/mux/mux-core.c:369:5: error: redefinition of 'mux_control_try_select'
    int mux_control_try_select(struct mux_control *mux, unsigned int state)
        ^~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/mux/mux-core.c:21:0:
   include/linux/mux/consumer.h:45:18: note: previous definition of 'mux_control_try_select' was here
    int __must_check mux_control_try_select(struct mux_control *mux,
                     ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/mux/mux-core.c:397:5: error: redefinition of 'mux_control_deselect'
    int mux_control_deselect(struct mux_control *mux)
        ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/mux/mux-core.c:21:0:
   include/linux/mux/consumer.h:51:5: note: previous definition of 'mux_control_deselect' was here
    int mux_control_deselect(struct mux_control *mux)
        ^~~~~~~~~~~~~~~~~~~~
>> drivers/mux/mux-core.c:432:21: error: redefinition of 'mux_control_get'
    struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
                        ^~~~~~~~~~~~~~~
   In file included from drivers/mux/mux-core.c:21:0:
   include/linux/mux/consumer.h:56:21: note: previous definition of 'mux_control_get' was here
    struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
                        ^~~~~~~~~~~~~~~
>> drivers/mux/mux-core.c:493:6: error: redefinition of 'mux_control_put'
    void mux_control_put(struct mux_control *mux)
         ^~~~~~~~~~~~~~~
   In file included from drivers/mux/mux-core.c:21:0:
   include/linux/mux/consumer.h:61:6: note: previous definition of 'mux_control_put' was here
    void mux_control_put(struct mux_control *mux) {}
         ^~~~~~~~~~~~~~~
>> drivers/mux/mux-core.c:514:21: error: redefinition of 'devm_mux_control_get'
    struct mux_control *devm_mux_control_get(struct device *dev,
                        ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/mux/mux-core.c:21:0:
   include/linux/mux/consumer.h:63:21: note: previous definition of 'devm_mux_control_get' was here
    struct mux_control *devm_mux_control_get(struct device *dev,
                        ^~~~~~~~~~~~~~~~~~~~

vim +/mux_control_states +290 drivers/mux/mux-core.c

a3b02a9c Peter Rosin 2017-05-14  284  /**
a3b02a9c Peter Rosin 2017-05-14  285   * mux_control_states() - Query the number of multiplexer states.
a3b02a9c Peter Rosin 2017-05-14  286   * @mux: The mux-control to query.
a3b02a9c Peter Rosin 2017-05-14  287   *
a3b02a9c Peter Rosin 2017-05-14  288   * Return: The number of multiplexer states.
a3b02a9c Peter Rosin 2017-05-14  289   */
a3b02a9c Peter Rosin 2017-05-14 @290  unsigned int mux_control_states(struct mux_control *mux)
a3b02a9c Peter Rosin 2017-05-14  291  {
a3b02a9c Peter Rosin 2017-05-14  292  	return mux->states;
a3b02a9c Peter Rosin 2017-05-14  293  }
a3b02a9c Peter Rosin 2017-05-14  294  EXPORT_SYMBOL_GPL(mux_control_states);
a3b02a9c Peter Rosin 2017-05-14  295  
a3b02a9c Peter Rosin 2017-05-14  296  /*
a3b02a9c Peter Rosin 2017-05-14  297   * The mux->lock must be down when calling this function.
a3b02a9c Peter Rosin 2017-05-14  298   */
a3b02a9c Peter Rosin 2017-05-14  299  static int __mux_control_select(struct mux_control *mux, int state)
a3b02a9c Peter Rosin 2017-05-14  300  {
a3b02a9c Peter Rosin 2017-05-14  301  	int ret;
a3b02a9c Peter Rosin 2017-05-14  302  
a3b02a9c Peter Rosin 2017-05-14  303  	if (WARN_ON(state < 0 || state >= mux->states))
a3b02a9c Peter Rosin 2017-05-14  304  		return -EINVAL;
a3b02a9c Peter Rosin 2017-05-14  305  
a3b02a9c Peter Rosin 2017-05-14  306  	if (mux->cached_state == state)
a3b02a9c Peter Rosin 2017-05-14  307  		return 0;
a3b02a9c Peter Rosin 2017-05-14  308  
a3b02a9c Peter Rosin 2017-05-14  309  	ret = mux_control_set(mux, state);
a3b02a9c Peter Rosin 2017-05-14  310  	if (ret >= 0)
a3b02a9c Peter Rosin 2017-05-14  311  		return 0;
a3b02a9c Peter Rosin 2017-05-14  312  
a3b02a9c Peter Rosin 2017-05-14  313  	/* The mux update failed, try to revert if appropriate... */
a3b02a9c Peter Rosin 2017-05-14  314  	if (mux->idle_state != MUX_IDLE_AS_IS)
a3b02a9c Peter Rosin 2017-05-14  315  		mux_control_set(mux, mux->idle_state);
a3b02a9c Peter Rosin 2017-05-14  316  
a3b02a9c Peter Rosin 2017-05-14  317  	return ret;
a3b02a9c Peter Rosin 2017-05-14  318  }
a3b02a9c Peter Rosin 2017-05-14  319  
a3b02a9c Peter Rosin 2017-05-14  320  /**
a3b02a9c Peter Rosin 2017-05-14  321   * mux_control_select() - Select the given multiplexer state.
a3b02a9c Peter Rosin 2017-05-14  322   * @mux: The mux-control to request a change of state from.
a3b02a9c Peter Rosin 2017-05-14  323   * @state: The new requested state.
a3b02a9c Peter Rosin 2017-05-14  324   *
a3b02a9c Peter Rosin 2017-05-14  325   * On successfully selecting the mux-control state, it will be locked until
a3b02a9c Peter Rosin 2017-05-14  326   * there is a call to mux_control_deselect(). If the mux-control is already
a3b02a9c Peter Rosin 2017-05-14  327   * selected when mux_control_select() is called, the caller will be blocked
a3b02a9c Peter Rosin 2017-05-14  328   * until mux_control_deselect() is called (by someone else).
a3b02a9c Peter Rosin 2017-05-14  329   *
a3b02a9c Peter Rosin 2017-05-14  330   * Therefore, make sure to call mux_control_deselect() when the operation is
a3b02a9c Peter Rosin 2017-05-14  331   * complete and the mux-control is free for others to use, but do not call
a3b02a9c Peter Rosin 2017-05-14  332   * mux_control_deselect() if mux_control_select() fails.
a3b02a9c Peter Rosin 2017-05-14  333   *
a3b02a9c Peter Rosin 2017-05-14  334   * Return: 0 when the mux-control state has the requested state or a negative
a3b02a9c Peter Rosin 2017-05-14  335   * errno on error.
a3b02a9c Peter Rosin 2017-05-14  336   */
a3b02a9c Peter Rosin 2017-05-14 @337  int mux_control_select(struct mux_control *mux, unsigned int state)
a3b02a9c Peter Rosin 2017-05-14  338  {
a3b02a9c Peter Rosin 2017-05-14  339  	int ret;
a3b02a9c Peter Rosin 2017-05-14  340  
a3b02a9c Peter Rosin 2017-05-14  341  	ret = down_killable(&mux->lock);
a3b02a9c Peter Rosin 2017-05-14  342  	if (ret < 0)
a3b02a9c Peter Rosin 2017-05-14  343  		return ret;
a3b02a9c Peter Rosin 2017-05-14  344  
a3b02a9c Peter Rosin 2017-05-14  345  	ret = __mux_control_select(mux, state);
a3b02a9c Peter Rosin 2017-05-14  346  
a3b02a9c Peter Rosin 2017-05-14  347  	if (ret < 0)
a3b02a9c Peter Rosin 2017-05-14  348  		up(&mux->lock);
a3b02a9c Peter Rosin 2017-05-14  349  
a3b02a9c Peter Rosin 2017-05-14  350  	return ret;
a3b02a9c Peter Rosin 2017-05-14  351  }
a3b02a9c Peter Rosin 2017-05-14  352  EXPORT_SYMBOL_GPL(mux_control_select);
a3b02a9c Peter Rosin 2017-05-14  353  
a3b02a9c Peter Rosin 2017-05-14  354  /**
a3b02a9c Peter Rosin 2017-05-14  355   * mux_control_try_select() - Try to select the given multiplexer state.
a3b02a9c Peter Rosin 2017-05-14  356   * @mux: The mux-control to request a change of state from.
a3b02a9c Peter Rosin 2017-05-14  357   * @state: The new requested state.
a3b02a9c Peter Rosin 2017-05-14  358   *
a3b02a9c Peter Rosin 2017-05-14  359   * On successfully selecting the mux-control state, it will be locked until
a3b02a9c Peter Rosin 2017-05-14  360   * mux_control_deselect() called.
a3b02a9c Peter Rosin 2017-05-14  361   *
a3b02a9c Peter Rosin 2017-05-14  362   * Therefore, make sure to call mux_control_deselect() when the operation is
a3b02a9c Peter Rosin 2017-05-14  363   * complete and the mux-control is free for others to use, but do not call
a3b02a9c Peter Rosin 2017-05-14  364   * mux_control_deselect() if mux_control_try_select() fails.
a3b02a9c Peter Rosin 2017-05-14  365   *
a3b02a9c Peter Rosin 2017-05-14  366   * Return: 0 when the mux-control state has the requested state or a negative
a3b02a9c Peter Rosin 2017-05-14  367   * errno on error. Specifically -EBUSY if the mux-control is contended.
a3b02a9c Peter Rosin 2017-05-14  368   */
a3b02a9c Peter Rosin 2017-05-14 @369  int mux_control_try_select(struct mux_control *mux, unsigned int state)
a3b02a9c Peter Rosin 2017-05-14  370  {
a3b02a9c Peter Rosin 2017-05-14  371  	int ret;
a3b02a9c Peter Rosin 2017-05-14  372  
a3b02a9c Peter Rosin 2017-05-14  373  	if (down_trylock(&mux->lock))
a3b02a9c Peter Rosin 2017-05-14  374  		return -EBUSY;
a3b02a9c Peter Rosin 2017-05-14  375  
a3b02a9c Peter Rosin 2017-05-14  376  	ret = __mux_control_select(mux, state);
a3b02a9c Peter Rosin 2017-05-14  377  
a3b02a9c Peter Rosin 2017-05-14  378  	if (ret < 0)
a3b02a9c Peter Rosin 2017-05-14  379  		up(&mux->lock);
a3b02a9c Peter Rosin 2017-05-14  380  
a3b02a9c Peter Rosin 2017-05-14  381  	return ret;
a3b02a9c Peter Rosin 2017-05-14  382  }
a3b02a9c Peter Rosin 2017-05-14  383  EXPORT_SYMBOL_GPL(mux_control_try_select);
a3b02a9c Peter Rosin 2017-05-14  384  
a3b02a9c Peter Rosin 2017-05-14  385  /**
a3b02a9c Peter Rosin 2017-05-14  386   * mux_control_deselect() - Deselect the previously selected multiplexer state.
a3b02a9c Peter Rosin 2017-05-14  387   * @mux: The mux-control to deselect.
a3b02a9c Peter Rosin 2017-05-14  388   *
a3b02a9c Peter Rosin 2017-05-14  389   * It is required that a single call is made to mux_control_deselect() for
a3b02a9c Peter Rosin 2017-05-14  390   * each and every successful call made to either of mux_control_select() or
a3b02a9c Peter Rosin 2017-05-14  391   * mux_control_try_select().
a3b02a9c Peter Rosin 2017-05-14  392   *
a3b02a9c Peter Rosin 2017-05-14  393   * Return: 0 on success and a negative errno on error. An error can only
a3b02a9c Peter Rosin 2017-05-14  394   * occur if the mux has an idle state. Note that even if an error occurs, the
a3b02a9c Peter Rosin 2017-05-14  395   * mux-control is unlocked and is thus free for the next access.
a3b02a9c Peter Rosin 2017-05-14  396   */
a3b02a9c Peter Rosin 2017-05-14 @397  int mux_control_deselect(struct mux_control *mux)
a3b02a9c Peter Rosin 2017-05-14  398  {
a3b02a9c Peter Rosin 2017-05-14  399  	int ret = 0;
a3b02a9c Peter Rosin 2017-05-14  400  
a3b02a9c Peter Rosin 2017-05-14  401  	if (mux->idle_state != MUX_IDLE_AS_IS &&
a3b02a9c Peter Rosin 2017-05-14  402  	    mux->idle_state != mux->cached_state)
a3b02a9c Peter Rosin 2017-05-14  403  		ret = mux_control_set(mux, mux->idle_state);
a3b02a9c Peter Rosin 2017-05-14  404  
a3b02a9c Peter Rosin 2017-05-14  405  	up(&mux->lock);
a3b02a9c Peter Rosin 2017-05-14  406  
a3b02a9c Peter Rosin 2017-05-14  407  	return ret;
a3b02a9c Peter Rosin 2017-05-14  408  }
a3b02a9c Peter Rosin 2017-05-14  409  EXPORT_SYMBOL_GPL(mux_control_deselect);
a3b02a9c Peter Rosin 2017-05-14  410  
a3b02a9c Peter Rosin 2017-05-14  411  static int of_dev_node_match(struct device *dev, const void *data)
a3b02a9c Peter Rosin 2017-05-14  412  {
a3b02a9c Peter Rosin 2017-05-14  413  	return dev->of_node == data;
a3b02a9c Peter Rosin 2017-05-14  414  }
a3b02a9c Peter Rosin 2017-05-14  415  
a3b02a9c Peter Rosin 2017-05-14  416  static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np)
a3b02a9c Peter Rosin 2017-05-14  417  {
a3b02a9c Peter Rosin 2017-05-14  418  	struct device *dev;
a3b02a9c Peter Rosin 2017-05-14  419  
a3b02a9c Peter Rosin 2017-05-14  420  	dev = class_find_device(&mux_class, NULL, np, of_dev_node_match);
a3b02a9c Peter Rosin 2017-05-14  421  
a3b02a9c Peter Rosin 2017-05-14  422  	return dev ? to_mux_chip(dev) : NULL;
a3b02a9c Peter Rosin 2017-05-14  423  }
a3b02a9c Peter Rosin 2017-05-14  424  
a3b02a9c Peter Rosin 2017-05-14  425  /**
a3b02a9c Peter Rosin 2017-05-14  426   * mux_control_get() - Get the mux-control for a device.
a3b02a9c Peter Rosin 2017-05-14  427   * @dev: The device that needs a mux-control.
a3b02a9c Peter Rosin 2017-05-14  428   * @mux_name: The name identifying the mux-control.
a3b02a9c Peter Rosin 2017-05-14  429   *
a3b02a9c Peter Rosin 2017-05-14  430   * Return: A pointer to the mux-control, or an ERR_PTR with a negative errno.
a3b02a9c Peter Rosin 2017-05-14  431   */
a3b02a9c Peter Rosin 2017-05-14 @432  struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
a3b02a9c Peter Rosin 2017-05-14  433  {
a3b02a9c Peter Rosin 2017-05-14  434  	struct device_node *np = dev->of_node;
a3b02a9c Peter Rosin 2017-05-14  435  	struct of_phandle_args args;

:::::: The code at line 290 was first introduced by commit
:::::: a3b02a9c6591ce154cd44e2383406390a45b530c mux: minimal mux subsystem

:::::: TO: Peter Rosin <peda@axentia.se>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 60446 bytes --]

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

* Re: [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case
  2017-07-07 21:41 [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case sathyanarayanan.kuppuswamy
  2017-07-08 15:32 ` kbuild test robot
@ 2017-07-08 20:55 ` Peter Rosin
  2017-07-08 23:04   ` Kuppuswamy, Sathyanarayanan
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Rosin @ 2017-07-08 20:55 UTC (permalink / raw)
  To: sathyanarayanan.kuppuswamy; +Cc: linux-kernel, sathyaosid

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", so this does not make sense.
Or do you have a driver that has an optional mux consumer?

> 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 */
> 

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

* Re: [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case
  2017-07-08 20:55 ` Peter Rosin
@ 2017-07-08 23:04   ` Kuppuswamy, Sathyanarayanan
  2017-07-10  5:32     ` Peter Rosin
  0 siblings, 1 reply; 5+ messages in thread
From: Kuppuswamy, Sathyanarayanan @ 2017-07-08 23:04 UTC (permalink / raw)
  To: Peter Rosin, sathyanarayanan.kuppuswamy; +Cc: linux-kernel

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 */
>>

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

* Re: [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case
  2017-07-08 23:04   ` Kuppuswamy, Sathyanarayanan
@ 2017-07-10  5:32     ` Peter Rosin
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Rosin @ 2017-07-10  5:32 UTC (permalink / raw)
  To: Kuppuswamy, Sathyanarayanan, sathyanarayanan.kuppuswamy; +Cc: linux-kernel

On 2017-07-09 01:04, Kuppuswamy, Sathyanarayanan wrote:
> 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.

Yeah, it's a valid use case. But why add a facility that noone uses? Sure,
if there's an actual consumer that needs it. But there isn't...

See, I have spent considerable time taking stuff like this out in order to
get the thing merged at all. I even think I wrote dummy inlines like this
at some point (but I'm not sure if I actually wrote them and I don't think
I submitted them. But I did think about it, that's for sure). Anyway, I'm
not very happy about ballooning the core with support for non-essentials
just yet. Maybe my mind-set will change over time?

(And no, I don't *know* the history behind the "Intel USB MUX driver",
 I e.g. never saw the consumer code. And I have the feeling that stuff
 were discussed in other threads that I was not part of and some (most?)
 questions I asked about it was left unanswered.)

Cheers,
peda

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

end of thread, other threads:[~2017-07-10  5:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-07 21:41 [PATCH v1 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case sathyanarayanan.kuppuswamy
2017-07-08 15:32 ` kbuild test robot
2017-07-08 20:55 ` Peter Rosin
2017-07-08 23:04   ` Kuppuswamy, Sathyanarayanan
2017-07-10  5:32     ` Peter Rosin

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