mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Anup Patel <anup@brainfault.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] rpmsg: Add driver_override device attribute for rpmsg_device
Date: Sun, 18 Mar 2018 15:47:36 -0700	[thread overview]
Message-ID: <20180318224736.GK5626@tuxbook-pro> (raw)
In-Reply-To: <1515590259-24304-1-git-send-email-anup@brainfault.org>

On Wed 10 Jan 05:17 PST 2018, Anup Patel wrote:

> This patch adds "driver_override" device attribute for rpmsg_device which
> will allow users to explicitly specify the rpmsg_driver to be used via
> sysfs entry.
> 
> The "driver_override" device attribute implemented here is very similar
> to "driver_override" implemented for platform, pci, and amba bus types.
> 
> One important use-case of "driver_override" device attribute is to force
> use of rpmsg_chrdev driver for certain rpmsg_device instances.
> 

I assume you mean specifically for the case where you want to prevent
some kernel driver to probe for some given channel?

The intention with rpmsg_char is that you through the rpmsg_ctrlX
interface create and destroy endpoints dynamically, so you wouldn't need
to use this mechanism to bind some specific channel to rpmsg_char.


That said, this does make sense for completeness sake.

[..]
> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index dffa3aa..9a25e42 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -321,11 +321,11 @@ struct device *rpmsg_find_device(struct device *parent,
>  }
>  EXPORT_SYMBOL(rpmsg_find_device);
>  
> -/* sysfs show configuration fields */
> +/* sysfs configuration fields */
>  #define rpmsg_show_attr(field, path, format_string)			\
>  static ssize_t								\
>  field##_show(struct device *dev,					\
> -			struct device_attribute *attr, char *buf)	\
> +	     struct device_attribute *attr, char *buf)			\

Seems unnecessary.

>  {									\
>  	struct rpmsg_device *rpdev = to_rpmsg_device(dev);		\
>  									\
> @@ -333,11 +333,52 @@ field##_show(struct device *dev,					\
>  }									\
>  static DEVICE_ATTR_RO(field);
>  
> +#define rpmsg_string_attr(field, path)					\

"path" is an odd name for these, I think it's a "member".

> +static ssize_t								\
> +field##_store(struct device *dev,					\
> +	      struct device_attribute *attr, const char *buf, size_t sz)\

field##_store(struct device *dev, struct device_attribute *attr, 	\
	      const char *buf, size_t sz)				\

Is prettier

> +{									\
> +	struct rpmsg_device *rpdev = to_rpmsg_device(dev);		\
> +	char *new, *old, *cp;						\
> +									\
> +	new = kstrndup(buf, sz, GFP_KERNEL);				\
> +	if (!new)							\
> +		return -ENOMEM;						\
> +									\
> +	cp = strchr(new, '\n');						\
> +	if (cp)								\
> +		*cp = '\0';						\

I prefer

	new[strcspn(new, "\n")] = '\0';

Regards,
Bjorn

  parent reply	other threads:[~2018-03-18 22:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 13:17 Anup Patel
2018-01-23 13:46 ` Anup Patel
2018-02-06  4:44 ` Anup Patel
2018-02-21 11:40 ` Anup Patel
2018-03-18 22:47 ` Bjorn Andersson [this message]
2018-03-21  7:59   ` Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180318224736.GK5626@tuxbook-pro \
    --to=bjorn.andersson@linaro.org \
    --cc=anup@brainfault.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=ohad@wizery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®