Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3639261ybi; Sun, 2 Jun 2019 19:51:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqynOEixuHRSvi95Rj+aacCdWy1xGQkqmqNbDrJ+/3BSWLgdv/AfoH/G7CELpuRitcKuGPVZ X-Received: by 2002:aa7:8dcd:: with SMTP id j13mr27569101pfr.107.1559530276519; Sun, 02 Jun 2019 19:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559530276; cv=none; d=google.com; s=arc-20160816; b=UzBCtEJxJyduRrpy6c5PbXWC5wWYiPzmhyFP0ppJ/PtMUnebbATapprH28R7ZvPHCF WaNqOiGvVERnIQhnq5Ia2iZy255lJUXtpWWopxukBAQFnVXcQy4ByrlTQWFjs8MllIYy wAWTPN/Q87UkzuvJzXw/f42OXVXsvHrsBtYzED4MsvPQYTvuMJKS6lhsihbvgy5u9Eq8 kHTl6aoo33PIyMLLTAX/SxZQVwafLzuwwygHK466pvHS0h2iLNoukJJ5pJJfsDvxgjsm gObLY9Y6sUFtiQRX6yBEMAcr4m44WQ9mRP+n2cNcOsvOcP/1v7d7nYenTokHwUg+L+G8 QygQ== 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=a1CCeZ0+LJk6Li2XljGQ21L59+Djw8U+2xXqB+0V5aw=; b=mstOKeIKj2zbxb8kVtJZWKxA7NfizE5usM5OC6Vd9s5iQqmZ4XK15fi58JxK4jGnJ5 R9c3u5eSFqKN+ytN8ywIBcDRSz60LQdrK+ziSb/Ga+tDxx+7HnnMVx+CiQUe5QWRjEQy TWR5kJAvG5gEb8Q/vsNzVZuYnFAV1gck7k2GpORquZGfbXU1QZayqmAy1e3SdHa3SpuD sAzKj9ibaNxwjw9BcQW1yJRO9+dVSM7CiXvpdyWiosa7hfh0zp98VbmpdGkzGe0+Oe6A PjCaehsU2fz/aZJKP5iE+pMPK6N3n557YbQW5uHidnNXsoY5Wt6YC7MAs727IazSAE8k zjlg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si2995111pgb.133.2019.06.02.19.51.00; Sun, 02 Jun 2019 19:51:16 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726991AbfFCCtM (ORCPT + 99 others); Sun, 2 Jun 2019 22:49:12 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:47830 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfFCCtL (ORCPT ); Sun, 2 Jun 2019 22:49:11 -0400 Received: from linux-8mug (prva10-snat226-2.provo.novell.com [137.65.226.36]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Sun, 02 Jun 2019 20:49:02 -0600 Date: Mon, 3 Jun 2019 10:48:50 +0800 From: Chester Lin To: Greg KH Cc: rjw@rjwysocki.net, lenb@kernel.org, jlee@suse.com, mhocko@suse.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] ACPI / device_sysfs: Add eject show attr to monitor eject status Message-ID: <20190603024850.GA664@linux-8mug> References: <20190531065642.13254-1-clin@suse.com> <20190531065642.13254-4-clin@suse.com> <20190531133859.GA18231@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190531133859.GA18231@kroah.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 31, 2019 at 06:38:59AM -0700, Greg KH wrote: > On Fri, May 31, 2019 at 02:56:42PM +0800, Chester Lin wrote: > > An acpi_eject_show attribute for users to monitor current status because > > sometimes it might take time to finish an ejection so we need to know > > whether it is still in progress or not. > > > > Signed-off-by: Chester Lin > > --- > > drivers/acpi/device_sysfs.c | 20 +++++++++++++++++++- > > drivers/acpi/internal.h | 1 + > > drivers/acpi/scan.c | 27 +++++++++++++++++++++++++++ > > 3 files changed, 47 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c > > index 78c2653bf020..70b22eec6bbc 100644 > > --- a/drivers/acpi/device_sysfs.c > > +++ b/drivers/acpi/device_sysfs.c > > @@ -403,7 +403,25 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, > > return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; > > } > > > > -static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); > > +static ssize_t acpi_eject_show(struct device *d, > > + struct device_attribute *attr, char *buf) > > +{ > > + struct acpi_device *acpi_device = to_acpi_device(d); > > + acpi_object_type not_used; > > + acpi_status status; > > + > > + if ((!acpi_device->handler || !acpi_device->handler->hotplug.enabled) > > + && !acpi_device->driver) > > + return -ENODEV; > > + > > + status = acpi_get_type(acpi_device->handle, ¬_used); > > + if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable) > > + return -ENODEV; > > + > > + return sprintf(buf, "%s\n", acpi_eject_status_string(acpi_device)); > > +} > > + > > +static DEVICE_ATTR(eject, 0644, acpi_eject_show, acpi_eject_store); > > DEVICE_ATTR_RW()? > > And you need to document the new sysfs file in Documentation/ABI/ > > thanks, > > greg k-h > Hi Greg, Thank you for the reminder and I will fix these two in v2. Regards, Chester