Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9292647imu; Wed, 5 Dec 2018 02:19:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/X4vhzyTc5B9ZB0GAImLcxn6zlY3tAWHz1sUJPvtiYxJWp0MMQjnAmX9cf+ggBMYAOUXAMX X-Received: by 2002:a63:3287:: with SMTP id y129mr18827024pgy.337.1544005167438; Wed, 05 Dec 2018 02:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544005167; cv=none; d=google.com; s=arc-20160816; b=s1Nzk2aBesIhV7j9tSZRvs4tjqBU+ckJbMDGV4mGRn8MzFYNByqaRi/i85XpFH5Xfj pB+LFZr/kB166SVS22lNjEp2/Cyu0PccmKElRe/5B4a8zrpbtgRb8CcY44tLCCkIgN3i wYil5zcQB5bVkejMDSh+rG9dOlu09o3xQ+WQ6AYOFjd/A5HOc2W8X83zvEZ/qm8LMmOj zBPHP+FY1tEly3Lp/mKucKcv02ZkQD6J7kN6/6U28MlzR+nufHL2lK+wOnm5z27/i9hd ueGD+T+j4pThnxk4fg7dF4BkI2ou3vabWEK6pMmuERi1ahgbQ6m7QuG2fOh1A4fQO5Zt LmrQ== 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; bh=kvfDHhXmI5Ukvi4w9KfT/599O4+4kgUxVydaMl5mDu4=; b=miWnMDDcIkawiqLeTxja/SpHvVnbkxQUDx9hCcR6j7I8V7S0ahGYmksLY/W36buTfd qgt1xpxSlUFvcn7gAkgyZI61kSE2ZX0Zc2Z/zxEGCTdu7HRM+pkWuptc2TYP4LDMk1/S SDaHvW49zxKox2ikdXFM5tU3Tj/BLdkSTf4xm5VQAMe21OaUeE+oIUiJOocLryoL5CXs N8UisHGizj+5hP4mIWF/L1Sc9cWM14eGB9WaTS0HIHIBmm3tnt7ZnNTSgvL65SJZotap 8FWj5hgDhu+V92tmjB+tsKpPO1vevyF2TGy8mfsk0od/vP74GaRUmp5vfWy6NQtx8PvZ lN+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CHLkfnQa; 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 m3si19109968pfh.58.2018.12.05.02.19.12; Wed, 05 Dec 2018 02:19:27 -0800 (PST) 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=@kernel.org header.s=default header.b=CHLkfnQa; 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 S1727600AbeLEKRG (ORCPT + 99 others); Wed, 5 Dec 2018 05:17:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:51590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727332AbeLEKRD (ORCPT ); Wed, 5 Dec 2018 05:17:03 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9336920659; Wed, 5 Dec 2018 10:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544005022; bh=rP+OpeHCUahFgYKl2Eey7epdZBodjVeeH/3leWGOIxo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CHLkfnQaPKTqWllMjj36F6zRRWcC8VDnBzC1h85uxV0lpcfpaE3Qw1cdYwTMYAsVz brxK3c94PgVx9rdo3XdqDZuVyTgrFd8FBuTObAgpqdN2UHjFVa1eohl7k85WxOAxc1 SRtZ9GjlXlF1eFuTgBjjXqmDH+O1FL/DY15XkdaI= Date: Wed, 5 Dec 2018 11:16:59 +0100 From: Greg KH To: Sven Van Asbroeck Cc: svendev@arcx.com, robh+dt@kernel.org, linus.walleij@linaro.org, lee.jones@linaro.org, mark.rutland@arm.com, afaerber@suse.de, treding@nvidia.com, david@lechnology.com, noralf@tronnes.org, johan@kernel.org, monstr@monstr.eu, michal.vokac@ysoft.com, arnd@arndb.de, john.garry@huawei.com, geert+renesas@glider.be, robin.murphy@arm.com, paul.gortmaker@windriver.com, sebastien.bourdelin@savoirfairelinux.com, icenowy@aosc.io, stuyoder@gmail.com, maxime.ripard@bootlin.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v5 1/6] fieldbus_dev: add Fieldbus Device subsystem. Message-ID: <20181205101659.GA27058@kroah.com> References: <20181204220224.27324-1-TheSven73@googlemail.com> <20181204220224.27324-2-TheSven73@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181204220224.27324-2-TheSven73@googlemail.com> User-Agent: Mutt/1.11.0 (2018-11-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 04, 2018 at 05:02:19PM -0500, Sven Van Asbroeck wrote: > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-class-fieldbus-dev > @@ -0,0 +1,63 @@ > +What: /sys/class/fieldbus_dev/fieldbus_devX/card_name Here's a good example of your naming being a bit too "verbose" :) There is no need to name your devices with the same prefix as your class. Just make it: /sys/class/fieldbus/XXX/card_name And why is this a class and not just a "normal" device and bus? Devices live on busses, not generally as a class. Can your devices live on different types of busses (USB, PCI, etc.)? But, if you really just want to leave this as a "class", then just call it "fieldbus" and make it simple. You are only exposing the "fieldbus-specific" type of attributes here, so that's probably good enough for now. > --- a/drivers/Makefile > +++ b/drivers/Makefile > @@ -187,4 +187,5 @@ obj-$(CONFIG_TEE) += tee/ > obj-$(CONFIG_MULTIPLEXER) += mux/ > obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/ > obj-$(CONFIG_SIOX) += siox/ > +obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ > obj-$(CONFIG_GNSS) += gnss/ Why not after gnss? > --- /dev/null > +++ b/drivers/fieldbus/Makefile > @@ -0,0 +1,9 @@ > +# SPDX-License-Identifier: GPL-2.0 > +# > +# Makefile for fieldbus_dev drivers. > +# > + > +obj-$(CONFIG_FIELDBUS_DEV) += fieldbus_dev_core.o Why not just "fieldbus.o"? > +static ssize_t online_show(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + struct fieldbus_dev *fb = dev_get_drvdata(dev); > + > + return snprintf(buf, PAGE_SIZE, "%s\n", Nit, sysfs attributes are always so small that you don't need to care about the size of the buffer because you "always" know that you will not overflow it. So this can just be a simple: return sprintf(buf, "%s\n", ...); > + fb->online ? "online" : "offline"); > +} > +static DEVICE_ATTR_RO(online); > + > +static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + struct fieldbus_dev *fb = dev_get_drvdata(dev); > + > + if (!fb->enable_get) > + return -EINVAL; > + return snprintf(buf, PAGE_SIZE, "%s\n", > + fb->enable_get(fb) ? ctrl_enabled : ctrl_disabled); > +} New line? > +static ssize_t enabled_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t n) > +{ > + struct fieldbus_dev *fb = dev_get_drvdata(dev); > + int err; > + > + if (!fb->simple_enable_set) { > + n = -ENOTSUPP; > + } else if (sysfs_streq(buf, ctrl_enabled)) { Why not just have the normal "0/1" type of parsing? We have a function for it already, kstrtobool(). thanks, greg k-h