Received: by 10.213.65.68 with SMTP id h4csp1050673imn; Wed, 21 Mar 2018 01:01:12 -0700 (PDT) X-Google-Smtp-Source: AG47ELvsQBsb63vL4KjM6ytW/FfGo8F5yAC0TX/U1N6/aajUthbHBx3T9MavAyBrtK2ioA9jIBMu X-Received: by 10.99.124.92 with SMTP id l28mr14245476pgn.51.1521619272217; Wed, 21 Mar 2018 01:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521619272; cv=none; d=google.com; s=arc-20160816; b=zIoEwDOzBYNT4zNUk5XSEEOk+XVUgDoiikHfF3HE2YJhNdR5uTIcF3PzsG7+eiih6y 3o/gsdynq6TFN9NhFxj4+k9vzHF6XZtN9DBMYW1edgswBjBZwS1mIcmAN5EmBFc/Y/eG npI71+/Jp6Ib6WtLbGKECBFB8owAyfTPTNOX2wEAADaVncSrXhznlPY9hMTbIMqJ5wyJ e+u2JQZfA4kQHUHaQGBjJnJFk4zp7b9xL4KtTZahsWtch4wZ1HydicA/lTqTJ4pMcQ8g HOkvNpq/34ENvacNCsvgFtyRPRASu8+ah8v56Wmm672IVZoFP1X9c2dh9lETZltXLRwC cnag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ybhlW9xS8c5Z8Cpspa0w0Cv9ZWoTyfCjk3I+qq9qSHs=; b=QQIWlznfKS4m++6PHPpON8aYSGNTeoEQ8OQMcl3xJ3cf5qoD2paRiM45JMwkwQs7XL 2KuA4W8aB3iMtikhVfFnBEarT1Sp9hVP/u/kxChAM9yyI7AQU+L2+EKpKFitR2edfZUW XPGF8RgFOP80nKjVgAiz6QgeS5Xi1c9soaO8Pv8/Q5o7z0b9i2iTkSt4xtZtlulxt3Bj /eyOxiL53WFWsRlk2E2EE6dlLghpPaFeKCfUrvn4wbthRsz4TkAPqDcgKDlrTqO+NN3U XJ3P0OCTOTcAUjvSeaVice7nU3mj1qgNHJN0T5lXSoEtrk27VPr1GYPl3rTWKagtffz0 izaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=X+oFeUkB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o69si2703640pfi.322.2018.03.21.01.00.57; Wed, 21 Mar 2018 01:01:12 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=X+oFeUkB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751541AbeCUIAD (ORCPT + 99 others); Wed, 21 Mar 2018 04:00:03 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37258 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbeCUIAA (ORCPT ); Wed, 21 Mar 2018 04:00:00 -0400 Received: by mail-wm0-f66.google.com with SMTP id 139so8054004wmn.2 for ; Wed, 21 Mar 2018 01:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ybhlW9xS8c5Z8Cpspa0w0Cv9ZWoTyfCjk3I+qq9qSHs=; b=X+oFeUkBVWMyvOkJRj1dlTzudfpiA/eefCERS7VgdAE7fFHtw7hLqYQ9q3bGu6qEow bCLguOXcnfaAVnasyECdNs0OfeZJglsROYbdd/oIp5oxY0ZN+Gtdr4x0ptTsDPpuv+kI xsr2HtUrVEJwuvwZrojrMQbWNzjK63DzhNGG6U+prOoXmPD3an6hlwfkmHwGajBLoAAo wvKXEUw41aQ0IW/6vUaESUy67FyiA9skNvIFZO+ExTS4x+KBUCBmX0n4HcdDJ/N0kmU+ SQAeamOFLDp2/acPqe0w1lUvQtwlYjireyLYcJVCnQlbY5+G8MWhB6UjFg3+73s2Mxrx oPGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ybhlW9xS8c5Z8Cpspa0w0Cv9ZWoTyfCjk3I+qq9qSHs=; b=XLczzWsb0i0F4Les7whkkPmECNe4Z8n/7+yedvnUD8a+ye03V+gx3FMXcpp5nLJkUK 0LkmGV7wQ90Oc1NiOO0firM+Qq0Ny5I+enaoOX+xkUTPYPiELo0UKDszxRfe3nh0wSHd ORZLZhpys/i3RmCcnohauGKvjxNKiP60r4Pqwbl6nwhHHVQDGfE90KJYkClM/BeOgbhz 12rTYwhKl9RTkkqNkkWKkIsckug3HSJxdPGt2b/GIKwL9dT51xTWyOusVavMHFR/YYjn tGOdR6pstbESzK/GIRW3Jc/LMpF/eSikhs1NPCz2WhPOhLx/wT7LZzws9iL3NqNjm2hL 2pRQ== X-Gm-Message-State: AElRT7HvIC28XN9JJ68gZNAIgM8ZDmAAzP7/KA/IkE85/GARQtTjeZfO bWNWBbIK/rYxbwZpYKiyqjMgkGf6BBcvzvETd7kkUA== X-Received: by 10.28.146.71 with SMTP id u68mr1960232wmd.107.1521619199166; Wed, 21 Mar 2018 00:59:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.154.87 with HTTP; Wed, 21 Mar 2018 00:59:58 -0700 (PDT) In-Reply-To: <20180318224736.GK5626@tuxbook-pro> References: <1515590259-24304-1-git-send-email-anup@brainfault.org> <20180318224736.GK5626@tuxbook-pro> From: Anup Patel Date: Wed, 21 Mar 2018 13:29:58 +0530 Message-ID: Subject: Re: [PATCH RESEND] rpmsg: Add driver_override device attribute for rpmsg_device To: Bjorn Andersson Cc: Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 19, 2018 at 4:17 AM, Bjorn Andersson wrote: > 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? Yes, there are few use-cases where we want to prevent kernel driver and rather access rpmsg device from user-space using rpmsg_chrdev driver. > > 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. OK, I will drop these changes. > >> { \ >> 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 OK, I will update this. > >> +{ \ >> + 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'; Sure, I will update this. Thanks, Anup