Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2330583ybi; Thu, 4 Jul 2019 09:01:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7rfYaZbgwAN6L0kOwDF/GBxtQRqNStGQ2rPu4WI+bqr1Qo2OhLVulQUxnyhm5z9bNsJOV X-Received: by 2002:a17:902:8d92:: with SMTP id v18mr50785318plo.211.1562256061818; Thu, 04 Jul 2019 09:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562256061; cv=none; d=google.com; s=arc-20160816; b=z4esD19cg0mgmpJFj3hppxbZW/zQKhHl6vveu9NIGZRqc8l5zb4kep0fo/GMlZxHGg ocAkmp3QKZnv7V2AMiBk+R8Yy6Obcf9srhF+Nkq/sJ69xcxSXnjqUEDIr8+mAmA+NY4A U2uMJOz/e4w94PJtRMkEJvVNEzhGFmPwUa5IaKMoRHM6yPT0ZJ8Yg6ZJu0rOL5jTJnUs +A8lBJDjXoPZEFmxN0rHMHe9RUes8Obt5jl/5eVn/9DQ3nO1FYfv6W83Bqa91zi3Cp4D Ro+tr9yTHqdeh0kh2XVI1O1a0u2qgUHS4a3CGYwar7tyhWXOLfL0ewOiyn7+ftAvcjLS vYpw== 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; bh=UXOUATVXRq94KpIqQGFi9bU+JypeCP7GOn9ygIqVDz0=; b=zUfa/BPK2hB0MCuUNeJkD1KtnY7YgMhpjWDYzuROMTOmsNA9zPUvdUh3CmwgmG6i5A hwfUrfPl/yH1LxTj7Hmc9ZqzysO50fQpHse/Q3TbWWfzEnhf26rrytFdii57z0BaysPC EljBu5Q4Oie11oTs5R4i3R6xuh/b6tnajiEr8Ttr6zDW8H8NQZCewukftZ5kxsCO5Ryy 1OkwiOP017OoXhPC8Oi5GFbYhRTAg+x9ar/RhebGVlYhUKND9ksUDGox7JvZ9cF0mWnA S2GifZV2oFsXbw7r9X0KmulmdYlFYpGsvNXYoWHFLdj5sGQByRiZOdJCs/gepujh6Qcm OwIA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t129si6080471pfb.16.2019.07.04.09.00.46; Thu, 04 Jul 2019 09:01:01 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727707AbfGDPbC (ORCPT + 99 others); Thu, 4 Jul 2019 11:31:02 -0400 Received: from mga06.intel.com ([134.134.136.31]:3318 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727474AbfGDPbC (ORCPT ); Thu, 4 Jul 2019 11:31:02 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2019 08:31:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,451,1557212400"; d="scan'208";a="172450290" Received: from hao-dev.bj.intel.com (HELO localhost) ([10.238.157.65]) by FMSMGA003.fm.intel.com with ESMTP; 04 Jul 2019 08:30:58 -0700 Date: Thu, 4 Jul 2019 23:14:17 +0800 From: Wu Hao To: Greg Kroah-Hartman Cc: Alan Tull , Moritz Fischer , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fpga: dfl: use driver core functions, not sysfs ones. Message-ID: <20190704151416.GA1423@hao-dev> References: <20190704055645.GA15471@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190704055645.GA15471@kroah.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 04, 2019 at 07:56:45AM +0200, Greg Kroah-Hartman wrote: > This is a driver, do not call "raw" sysfs functions, instead call driver > core ones. Specifically convert the use of sysfs_create_files() and > sysfs_remove_files() to use device_add_groups() and > device_remove_groups() Hi Greg, Thanks for this patch. It looks good, and works well in my side. I will follow the same (replace sysfs_create/remove_* with device_add/remove_group) to rework my patchset too. Thanks. Hao > > Cc: Wu Hao > Cc: Alan Tull > Cc: Moritz Fischer > Cc: linux-fpga@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman > --- > drivers/fpga/dfl-afu-main.c | 14 ++++++++------ > drivers/fpga/dfl-fme-main.c | 7 ++++--- > 2 files changed, 12 insertions(+), 9 deletions(-) > > diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c > index 02baa6a227c0..68b4d0874b93 100644 > --- a/drivers/fpga/dfl-afu-main.c > +++ b/drivers/fpga/dfl-afu-main.c > @@ -141,10 +141,11 @@ id_show(struct device *dev, struct device_attribute *attr, char *buf) > } > static DEVICE_ATTR_RO(id); > > -static const struct attribute *port_hdr_attrs[] = { > +static struct attribute *port_hdr_attrs[] = { > &dev_attr_id.attr, > NULL, > }; > +ATTRIBUTE_GROUPS(port_hdr); > > static int port_hdr_init(struct platform_device *pdev, > struct dfl_feature *feature) > @@ -153,7 +154,7 @@ static int port_hdr_init(struct platform_device *pdev, > > port_reset(pdev); > > - return sysfs_create_files(&pdev->dev.kobj, port_hdr_attrs); > + return device_add_groups(&pdev->dev, port_hdr_groups); > } > > static void port_hdr_uinit(struct platform_device *pdev, > @@ -161,7 +162,7 @@ static void port_hdr_uinit(struct platform_device *pdev, > { > dev_dbg(&pdev->dev, "PORT HDR UInit.\n"); > > - sysfs_remove_files(&pdev->dev.kobj, port_hdr_attrs); > + device_remove_groups(&pdev->dev, port_hdr_groups); > } > > static long > @@ -214,10 +215,11 @@ afu_id_show(struct device *dev, struct device_attribute *attr, char *buf) > } > static DEVICE_ATTR_RO(afu_id); > > -static const struct attribute *port_afu_attrs[] = { > +static struct attribute *port_afu_attrs[] = { > &dev_attr_afu_id.attr, > NULL > }; > +ATTRIBUTE_GROUPS(port_afu); > > static int port_afu_init(struct platform_device *pdev, > struct dfl_feature *feature) > @@ -234,7 +236,7 @@ static int port_afu_init(struct platform_device *pdev, > if (ret) > return ret; > > - return sysfs_create_files(&pdev->dev.kobj, port_afu_attrs); > + return device_add_groups(&pdev->dev, port_afu_groups); > } > > static void port_afu_uinit(struct platform_device *pdev, > @@ -242,7 +244,7 @@ static void port_afu_uinit(struct platform_device *pdev, > { > dev_dbg(&pdev->dev, "PORT AFU UInit.\n"); > > - sysfs_remove_files(&pdev->dev.kobj, port_afu_attrs); > + device_remove_groups(&pdev->dev, port_afu_groups); > } > > static const struct dfl_feature_ops port_afu_ops = { > diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c > index 086ad2420ade..0be4635583d5 100644 > --- a/drivers/fpga/dfl-fme-main.c > +++ b/drivers/fpga/dfl-fme-main.c > @@ -72,12 +72,13 @@ static ssize_t bitstream_metadata_show(struct device *dev, > } > static DEVICE_ATTR_RO(bitstream_metadata); > > -static const struct attribute *fme_hdr_attrs[] = { > +static struct attribute *fme_hdr_attrs[] = { > &dev_attr_ports_num.attr, > &dev_attr_bitstream_id.attr, > &dev_attr_bitstream_metadata.attr, > NULL, > }; > +ATTRIBUTE_GROUPS(fme_hdr); > > static int fme_hdr_init(struct platform_device *pdev, > struct dfl_feature *feature) > @@ -89,7 +90,7 @@ static int fme_hdr_init(struct platform_device *pdev, > dev_dbg(&pdev->dev, "FME cap %llx.\n", > (unsigned long long)readq(base + FME_HDR_CAP)); > > - ret = sysfs_create_files(&pdev->dev.kobj, fme_hdr_attrs); > + ret = device_add_groups(&pdev->dev, fme_hdr_groups); > if (ret) > return ret; > > @@ -100,7 +101,7 @@ static void fme_hdr_uinit(struct platform_device *pdev, > struct dfl_feature *feature) > { > dev_dbg(&pdev->dev, "FME HDR UInit.\n"); > - sysfs_remove_files(&pdev->dev.kobj, fme_hdr_attrs); > + device_remove_groups(&pdev->dev, fme_hdr_groups); > } > > static const struct dfl_feature_ops fme_hdr_ops = { > -- > 2.22.0