Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2121462pxj; Thu, 20 May 2021 00:09:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbad6lW5ekSerDO2l6QgmuON8Dq1z7RGe6RwxGeXe+MXSGEUBB/MHcsFWE1nqmT296E5nE X-Received: by 2002:a50:eb89:: with SMTP id y9mr3446678edr.257.1621494598202; Thu, 20 May 2021 00:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621494598; cv=none; d=google.com; s=arc-20160816; b=ERHGrPk7jE4fuOW1XNdqpiE5lNCSLdWzTwQ51IQn6NAgWeAu19L3e3E196ju11xigN q/2DKz117O19CFuxpPewbQVHAjM6B5V9i+WnJgabutYOGnATvVx8Mjuk0eTN5UBGaGQK u7TTa1LaF0ycF01gEFqGyq9BUxt95tpjd8LSBDa1kt2STb5nPvWh7fxuyyIbkBSYdrwU mv52nJz3X4sLtMr7mM2tRTq5NHoncsJDVrPImnRY1JBt7QnMpQ6Gz0dhzBYcrNrbJJ9s onKAMowJCb1SNFSyokFhCfn/wrvsPasGiL32mQ8FyAfjy9rj6j5jS0I/Zgh/KSACmVPt Pf0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=04jk9M0HK46R4kcGQl6Qf2KnTu9a/Rky3MH6jTjbpJ8=; b=HHe/xxSyn8gSHoHMNwVpf7NxWg8QaxQElphSkm9BFJteYcxKbJLEJzVFQEf581O3wL 0BCtEoe1o013yq4ajmPe8/keXhc1AH13cM1/5II7/aDDZhrdff6XN518gXVUsyeinHto ogBoXl58GVco1hWM3Cfedyf9J7cpagnZSMoY97Y/g9Ua09CJcF2z0Yri3dwhyTf9d0bs zH1rH4XXuIdFiBZTzrhJw9jcWh3/qCHrjrkRlxMx3oL9XCZItl3d5ROwReMFmZ3jtC56 g6tdlJhWLjNVlB5EhzboedR2T+jIQavnBziRtLPavI0RoX018asj2kh8h8hcPUg7HORq CAbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QzFFmI83; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si1927163ejw.475.2021.05.20.00.09.33; Thu, 20 May 2021 00:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QzFFmI83; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230437AbhETHJu (ORCPT + 99 others); Thu, 20 May 2021 03:09:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:49196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbhETHJs (ORCPT ); Thu, 20 May 2021 03:09:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D3BA6124C; Thu, 20 May 2021 07:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621494506; bh=vyLAtGMQO50f0B4tMr5Ie5sS01PDBidzS4f5U/kcH0c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QzFFmI833N9MqnAa0zU/wo10tSYWPpia43R/LYQTyx3FZ56KR4kMxNdUIVNQJoMuB HLbOBNCyXqoaKQkHYU8UJxZsV2v02G/vmCSvGhmd/C4+9kf69aY3ZMioQ5LZOjqM61 /bmTZE++IYBqyef549TPG1f3bP5T2q92L3gRTWHw= Date: Thu, 20 May 2021 09:08:24 +0200 From: Greg Kroah-Hartman To: =?utf-8?B?SmnFmcOt?= Prchal Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , Christian Eggers , Arnd Bergmann Subject: Re: [PATCH v4 4/4] nvmem: eeprom: at25: export FRAM serial num Message-ID: References: <20210520054714.8736-1-jiri.prchal@aksignal.cz> <20210520054714.8736-5-jiri.prchal@aksignal.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 20, 2021 at 08:56:39AM +0200, Jiří Prchal wrote: > Here I'm completlly lost: > > On 20. 05. 21 7:52, Greg Kroah-Hartman wrote: > > On Thu, May 20, 2021 at 07:47:14AM +0200, Jiri Prchal wrote: > > > This exports serial number of FRAM in sysfs file named "sernum". > > > Formatted in hex, each byte separated by space. > > > Example: > > > $ cat /sys/class/spi_master/spi0/spi0.0/sernum > > > > No new Documentation/ABI/ entry for this? > No, should I do and how / where? All sysfs files need a Documentation/ABI/ entry. > > > +static ssize_t sernum_show(struct device *dev, struct device_attribute *attr, char *buf) > > > +{ > > > + struct at25_data *at25; > > > + int i; > > > + > > > + at25 = dev_get_drvdata(dev); > > > + for (i = 0; i < FM25_SN_LEN; i++) > > > + buf += sprintf(buf, "%02x ", at25->sernum[i]); > > > + sprintf(--buf, "\n"); > > > + return (3 * i); > > > > No, that is not how sysfs files work, sorry. They are "one value per > > file". This looks like multiple values in the same file, why not just > > one file per "sernum"? > It's formatted by spaces. It's one long number like MAC addr, so is better > to expose it as hex string without spaces? Or like MAC separated by colon? Why format it at all? Just dump out the whole thing as a string. But who is going to care about this? What tool will be reading it and what will it be for? The Documentation/ABI/ entry would help explain all of this. > > > + /* Export the FM25 serial number */ > > > + if (at25->has_sernum) { > > > + err = device_create_file(&spi->dev, &dev_attr_sernum); > > > > You just raced with userspace and lost :( > ? > > > > Please do this correctly, by setting the driver group if you need a file > > like this. > Any example, please? Loads, see any platform driver that sets the dev_groups pointer. thanks, greg k-h