Received: by 10.213.65.68 with SMTP id h4csp1124372imn; Sun, 18 Mar 2018 15:49:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELthrjETG7OzyI5yIIWzfa8Oneb+0OPxP+PORIpYg8/yr7hAVTMUDMVhB+gap6IgtZrLroAc X-Received: by 10.99.37.70 with SMTP id l67mr3241152pgl.106.1521413353716; Sun, 18 Mar 2018 15:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521413353; cv=none; d=google.com; s=arc-20160816; b=NCF6huihUYE1CjNZXdKpc+737FM4TbBtquR1E4LPM6WZOnNp1zwD2yMjfM8SCAP6g/ 4loGRoDcG6cSWdVVRJ08EFMWI5SOimT5ODfrUkPx+PjJcGUW4qjwDAFkj3JlIMXt/a8N OWQlgBSz2W9vtovXOWryFGC0onC0//HgSef5tKclPQucX2pqzjpj5KRXLZbZc4UObSKG FAnolrAhNwSjmXvkXsbAHUzUUiP7RH/HKdhdf/CaE1AdICcmT8FawhVhbVAJbWrCHaiM xvR9raJbBahquGSrIjcJw0dArLuhVdTQPWxg20k5eT060gVy6iXsU4ZZgWB2blHKiTX1 RTKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=z5w0VvgfItlxX7th8t6sbIxiEGcwyFeoSuJ4ARrUCFg=; b=bO4NsM7TIqcvDyS5Oy5jB/pWqWsHeH2q1yDcAw21FwsSp28QPdMWdpWlsI0egxCC8/ LOEOjQlChHSPdX3kxp+kB1VVBQwRLObJbG3MSkHelELWBWgjJUHMKrB8nlqu0Ze/9isa XRA3qNjJhQt6NojCLRR+zFR/NRdfzokKyFj5J5BdLLTKuoO0H3VaXilyaq4bWBzjN3n/ 2EwQLiFohkxqgjuxoHULPNsSJSYJoKPP7cQ01i6cSDHv39XsuUFN+hBzzcAypKxnqqJX 4u2sdC9V5ZCYCpB4Ohm14CqO+MayUYr4CgCGUCSFSjqrNb1u+RVjX55C7daAkVpZUL5M yxlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SZj8OTOr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g190si7474184pfb.308.2018.03.18.15.48.59; Sun, 18 Mar 2018 15:49:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SZj8OTOr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754941AbeCRWrg (ORCPT + 99 others); Sun, 18 Mar 2018 18:47:36 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:36360 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754926AbeCRWre (ORCPT ); Sun, 18 Mar 2018 18:47:34 -0400 Received: by mail-pl0-f67.google.com with SMTP id 61-v6so9115651plf.3 for ; Sun, 18 Mar 2018 15:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=z5w0VvgfItlxX7th8t6sbIxiEGcwyFeoSuJ4ARrUCFg=; b=SZj8OTOrwkooWp5Cn39y6PNTlhtADtztaAl9WGKvCBnHFlrztaG0uQxr5bkMgBMdc1 Xg6DjcnDHMcOEIZmC2thiFGDiJEd3RyB3CcPpbthAFzP/raHIAqiPXzBPvBbOuIKK3tk Lj2zH7lfIiaanvsjzdvvR0VvWrKWvneJSah6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=z5w0VvgfItlxX7th8t6sbIxiEGcwyFeoSuJ4ARrUCFg=; b=FgAIOQEGTsrF/9EwUXNNDvROpRLijOqXkwnZGVi+0Cxxs5esdvkKPaVEBCAOX0uZVY A1c7oDSMeokhkLeDkmIYNhzvWBykHiaDSI/mrgMdILHtcIplRCiWDnEbhdUVxA9NECyZ 2ZE5QQiGA6TJT3GdGocMJD2prSeV6e863IDW/znOuYTei3wOVyAFDvoCLHXv5USiFyOa PT6st6CY9gFGk0GbacxPq/qITCkIXzc6XrbuvV76oKb73detMiTX98HSs33xNJOqLKVH 5O7KxBLqdX2dKCqXA67aiQh8MGBCrvssgNVv8/0rDfxrFNy61jWc5dWs9I6prHC4NiFR m/3g== X-Gm-Message-State: AElRT7FI25sdWpT7LqPCxt+O2V/bqYpGzVFGxHEZjA41TPAixtcbWWh4 LCADBhf5odSdbK3GzY99dA6B7A== X-Received: by 2002:a17:902:32a2:: with SMTP id z31-v6mr9945083plb.32.1521413253700; Sun, 18 Mar 2018 15:47:33 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id t20sm23625051pfh.182.2018.03.18.15.47.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Mar 2018 15:47:33 -0700 (PDT) Date: Sun, 18 Mar 2018 15:47:36 -0700 From: Bjorn Andersson To: Anup Patel Cc: Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND] rpmsg: Add driver_override device attribute for rpmsg_device Message-ID: <20180318224736.GK5626@tuxbook-pro> References: <1515590259-24304-1-git-send-email-anup@brainfault.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1515590259-24304-1-git-send-email-anup@brainfault.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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