Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp360495pxb; Sat, 9 Oct 2021 23:29:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkorY1FmOftwT8YmA6ba61xz0wJkdAO0QHUgm/bHDIG9P8pgyXduTjeTnj7IVN97XLGlGR X-Received: by 2002:a05:6402:19ba:: with SMTP id o26mr30289565edz.1.1633847340301; Sat, 09 Oct 2021 23:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633847340; cv=none; d=google.com; s=arc-20160816; b=w5TmtStKhOALNHYl2Lcx0dQ6p/8eQw4S4CpdTC86vywQ+8a20q7vqU1xwpZ6t/2Jja E9kFUjAG4IRDG5kkjxVVEYmedDHvhePDWeqhYhoNkeVBWd4eZ9vWij7WpWkfj4ugVC+W wYM6GsknvNLQ6Y2usygsI+IyugIwiWFM0KTLkhNoK4KMaZgodt2DJzHs+vs5R5aaI68A BC1X2BH117ooflf9d5FAvugf6GpLPFnGp+5EMXJR1QqS9rEoTM+mOn+8qlT1DuxQ1+sk P8C+RTd1zszOrkuSvwhb2z4kzX6ytPx+MJCzDcUQAQoWWj6c+/EHAKCP7bBbLq2Q/7bX H/Yw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=V172EKpqGdcKP2a1fZsvqqU4Fo6Wuu6XW1Be53x0EBA=; b=CenQcFz48zy7dXiq0NaUi2zx2+tn3cEtMUj/VedrLA9iEo6WmZUzhVGbzHe3tivBu+ LGNXxlO7l7YOTIdpUPtzbsadnzoKpOUKp/4GaEhx/y5BfS2qceH0E7JisScVHYB6zqBl cdHZEIlyyIjpD4ULm/uliWa2c8XHQ/kHEswr2uc0B9OVYmKSX+5vza1XTqQCmMO+y9C2 7fLmfDpcDm6wfA6UIFJNkKAA3MTmweAxIBGWB26Z/E9B7ZYdw96y5NIO34ocqMXDzJN/ RN7hoXRiATCVRFuMjf6fZGAr8ddgoW9SpVfp+ZTyY04vBqBTBJj9TGYLnH1GO04NazwV bxtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hacgzfcl; 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 i27si6068756ejh.465.2021.10.09.23.28.35; Sat, 09 Oct 2021 23:29:00 -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=hacgzfcl; 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 S230315AbhJJG3O (ORCPT + 99 others); Sun, 10 Oct 2021 02:29:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:43070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbhJJG3N (ORCPT ); Sun, 10 Oct 2021 02:29:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 715B160EBD; Sun, 10 Oct 2021 06:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633847236; bh=vCnFyg7canN42mdsHkanNiVAESAJuv9PTNd0CNc46Yc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hacgzfcl3I/VAx5sHgppfAvIYKfho33lLH9/83aZCBQ61aa3YnQjY5qkV4x8vH3qP N5eoBu/gTk10Kxw35Q7hp9BFfhcapj8S/4KHQm8nfUHn69R8jAJTEIIe0VxQaZjhZf gZrAq1mby0BpU9uxitlOBJBgCFnD9Ys/kLEROxow= Date: Sun, 10 Oct 2021 08:27:10 +0200 From: Greg Kroah-Hartman To: Nikita Yushchenko Cc: Christian Gromm , Lee Jones , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] staging: most: dim2: do not double-register the same device Message-ID: References: <20211005143448.8660-1-nikita.yoush@cogentembedded.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211005143448.8660-1-nikita.yoush@cogentembedded.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 05, 2021 at 05:34:48PM +0300, Nikita Yushchenko wrote: > Commit 723de0f9171e ("staging: most: remove device from interface > structure") moved registration of driver-provided struct device to > the most subsystem. > > Dim2 used to register the same struct device to provide a custom device > attribute. This causes double-registration of the same struct device. > > Fix that by moving the custom attribute to driver's dev_groups. > This moves attribute to the platform_device object, which is a better > location for platform-specific attributes anyway. > > Fixes: 723de0f9171e ("staging: most: remove device from interface structure") > Signed-off-by: Nikita Yushchenko > --- > drivers/staging/most/dim2/Makefile | 2 +- > drivers/staging/most/dim2/dim2.c | 31 ++++++++++++------- > drivers/staging/most/dim2/sysfs.c | 49 ------------------------------ > drivers/staging/most/dim2/sysfs.h | 11 ------- > 4 files changed, 21 insertions(+), 72 deletions(-) > delete mode 100644 drivers/staging/most/dim2/sysfs.c > > diff --git a/drivers/staging/most/dim2/Makefile b/drivers/staging/most/dim2/Makefile > index 861adacf6c72..5f9612af3fa3 100644 > --- a/drivers/staging/most/dim2/Makefile > +++ b/drivers/staging/most/dim2/Makefile > @@ -1,4 +1,4 @@ > # SPDX-License-Identifier: GPL-2.0 > obj-$(CONFIG_MOST_DIM2) += most_dim2.o > > -most_dim2-objs := dim2.o hal.o sysfs.o > +most_dim2-objs := dim2.o hal.o > diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c > index e8b03fa90e80..bb6dd508e531 100644 > --- a/drivers/staging/most/dim2/dim2.c > +++ b/drivers/staging/most/dim2/dim2.c > @@ -118,7 +118,8 @@ struct dim2_platform_data { > (((p)[1] == 0x18) && ((p)[2] == 0x05) && ((p)[3] == 0x0C) && \ > ((p)[13] == 0x3C) && ((p)[14] == 0x00) && ((p)[15] == 0x0A)) > > -bool dim2_sysfs_get_state_cb(void) > +static ssize_t state_show(struct device *dev, struct device_attribute *attr, > + char *buf) > { > bool state; > unsigned long flags; > @@ -127,9 +128,25 @@ bool dim2_sysfs_get_state_cb(void) > state = dim_get_lock_state(); > spin_unlock_irqrestore(&dim_lock, flags); > > - return state; > + return sprintf(buf, "%s\n", state ? "locked" : ""); sysfs_emit()? > } > > +static DEVICE_ATTR_RO(state); > + > +static struct attribute *dim2_dev_attrs[] = { > + &dev_attr_state.attr, > + NULL, > +}; > + > +static struct attribute_group dim2_attr_group = { > + .attrs = dim2_dev_attrs, > +}; > + > +static const struct attribute_group *dim2_attr_groups[] = { > + &dim2_attr_group, > + NULL, > +}; ATTRIBUTE_GROUPS()? Other than these minor things, looks good, thanks for doing this! greg k-h