Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp627934ybi; Fri, 31 May 2019 06:41:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWToQTdxlxVB8PoYdOhdTGBJQy1IgoB+y/Hq1yny3ijBPm6QCULLr0sCB+WLkldUUT82yV X-Received: by 2002:a62:e205:: with SMTP id a5mr10253254pfi.40.1559310112546; Fri, 31 May 2019 06:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559310112; cv=none; d=google.com; s=arc-20160816; b=FfBcu16pXQ8fAj6wZWtd9o0d08aefpSrW6WDIDQZ5nAtcDFyFvP35y6ywOfQR+adVL YS/yjDaOmJvzGBsCnDnFMT/6nUwS1Q3Yr6BZk6S7z+BDuclRwveiT5VAqkQScMQBV3r+ aaHy575nUve4PoqzPAv0Ouqc86Zi5SSEiQs6Fdg9WzN4XhJrssgV+HklSwUaHD8UNwWk hEXLXRqWwPqQTC8EZ7/78/jDCkMi7a6Ge3sMChMbJtjo+QnQ3HAPKGT6qYBcRUj3NVJ3 WVZMfd/HRBN62+lOf1n88lOko3dxM49gYeQsED7mdVd/rGrsv8TmxBclvB6+Xoy8V8DT 7kXA== 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:dkim-signature; bh=Qkx+S6NKMk3QjwAQlavpJE36moUg1KC6GexpjovRTd0=; b=k3+lvEMPLHSoUryhEoUebu0ci0HJ5yNPxjWJebi6ZpOsEs1migDlULShiok/rpkY95 yGoQPOyuwYBVQMhjJLDU4t5sONTZr2mX8OnLQglOzuOnlenwm3Wr16PH3vYO3sQVzkL1 De1wq2qsf7Iy3KRqbZLI9QXfuoOlhH+4Od5hJiHdKZzsZD8n6BKn9hHNWhwiZ2RgCmpW R4SK3QVfEXLztoOLOK+MtT0zeoM5w9OxL8n4f7ZzW0SSsKhCp1BfdP7l45KkMGO8LyeP ciC03Wfyk/iTcqo+rZyOvHx7J0hYWDyU0ScZTVHymi4U98pT3jQkOlKrI5KaIxZLkRt7 0Ztg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2DpJfcg9; 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 u136si7234400pfc.121.2019.05.31.06.41.34; Fri, 31 May 2019 06:41:52 -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; dkim=pass header.i=@kernel.org header.s=default header.b=2DpJfcg9; 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 S1726687AbfEaNjB (ORCPT + 99 others); Fri, 31 May 2019 09:39:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:59484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbfEaNjA (ORCPT ); Fri, 31 May 2019 09:39:00 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EF37C2133D; Fri, 31 May 2019 13:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559309940; bh=QejsJpJ1Xnpne98lLX4jJknIWWCbhoxePOTvB7gNbik=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2DpJfcg9pfYTbU/2GXZr+pVR6QrKcy/SxJT9K74RqSRcrUqiy0DouKcIURLcqTko1 7fuV4O9/u3a7R+tuQ+pocFsSHlNfHxWXThM8iAh6BxQ33YmqzQu0W7z0WcxZ1LPIB+ LG8OeYRqgUIOEDZwYU5HWB/R53uXTa0o3tq7Z++U= Date: Fri, 31 May 2019 06:38:59 -0700 From: Greg KH To: Chester Lin 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: <20190531133859.GA18231@kroah.com> References: <20190531065642.13254-1-clin@suse.com> <20190531065642.13254-4-clin@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190531065642.13254-4-clin@suse.com> User-Agent: Mutt/1.12.0 (2019-05-25) 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 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