From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00F0EC04A95 for ; Thu, 29 Sep 2022 07:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yVihC1qsJ4wjlKMeVZiZuz+mIpYa/N0MZxOHn1gXpHg=; b=zebe9A4zKZinBH NKX21d5NJ444J1QM7e38jgOIioE8Px3QtrLFEpv4EGUl/dSLu9ix0HjAhB00UkLhSaL2Y9XiWUjeC 7qrfrdPQCnsY9n+bz+u83L1XhP9efq3j3g74KpD034Cvzm3C+9ZylWGNg/KbfH6d6l/4Uc7CjRyqk WSYYkdePV3M/5Pax+rfMjBJgVkxLwe/Xs6F2eiYD1rswOtEfwp3eKH6tc6Y/QfySFY+w6hyB30ngC maVylsgLGC5Ao3R3BHGTNY+vZb21bCER3EzlbpVLhQYy19NizlCM48XSQpF26M2aFhbS4x+UEDvmH oBhSafEVpbBGWREfOyCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1odo6Y-001bUK-7y; Thu, 29 Sep 2022 07:37:10 +0000 Received: from smtprelay0016.hostedemail.com ([216.40.44.16] helo=relay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1odo6T-001bQn-SW for linux-arm-kernel@lists.infradead.org; Thu, 29 Sep 2022 07:37:08 +0000 Received: from omf07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E3A941C60E3; Thu, 29 Sep 2022 07:36:57 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA id E57402002C; Thu, 29 Sep 2022 07:36:44 +0000 (UTC) Message-ID: <3c02aad6d8bde70964b403a3cb8004de969becc6.camel@perches.com> Subject: Re: [PATCH v4 10/14] gunyah: sysfs: Add node to describe supported features From: Joe Perches To: Elliot Berman , Bjorn Andersson Cc: Murali Nalajala , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Andy Gross , Dmitry Baryshkov , Jassi Brar , linux-arm-kernel@lists.infradead.org, Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Will Deacon , Catalin Marinas , Arnd Bergmann , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 29 Sep 2022 00:36:50 -0700 In-Reply-To: <20220928195633.2348848-11-quic_eberman@quicinc.com> References: <20220928195633.2348848-1-quic_eberman@quicinc.com> <20220928195633.2348848-11-quic_eberman@quicinc.com> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Stat-Signature: yfqwchey9yq5eu51co5zpzk7inon4u6t X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: E57402002C X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/SbFmnkC0u2VswP4hwzbj5pLQd0DpRqLM= X-HE-Tag: 1664437004-361455 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220929_003706_069809_3507E9EB X-CRM114-Status: GOOD ( 13.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 2022-09-28 at 12:56 -0700, Elliot Berman wrote: > Add a sysfs node to list the features that the Gunyah hypervisor and > Linux supports. For now, Linux support cspace (capability IDs) and > message queues, so only report those.. [] > diff --git a/drivers/virt/gunyah/sysfs.c b/drivers/virt/gunyah/sysfs.c [] > @@ -25,9 +25,24 @@ static ssize_t variant_show(struct kobject *kobj, struct kobj_attribute *attr, c > } > static struct kobj_attribute variant_attr = __ATTR_RO(variant); > > +static ssize_t features_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer) > +{ > + int len = 0; > + > + if (GH_IDENTIFY_PARTITION_CSPACE(gunyah_api.flags)) > + len += sysfs_emit_at(buffer, len, "cspace "); > + if (GH_IDENTIFY_MSGQUEUE(gunyah_api.flags)) > + len += sysfs_emit_at(buffer, len, "message-queue "); > + > + len += sysfs_emit_at(buffer, len, "\n"); > + return len; > +} It's generally nicer to avoid unnecessary output spaces. Perhaps: { int len = 0; if (GH_IDENTIFY_PARTITION_CSPACE(gunyah_api.flags)) len += sysfs_emit_at(buffer, len, "cspace"); if (GH_IDENTIFY_MSGQUEUE(gunyah_api.flags)) { if (len) len += sysfs_emit_at(buffer, len, " "); len += sysfs_emit_at(buffer, len, "message-queue"); } len += sysfs_emit_at(buffer, len, "\n"); return len; } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel