Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1498897imu; Mon, 5 Nov 2018 22:48:31 -0800 (PST) X-Google-Smtp-Source: AJdET5eb3YZJ7pDbgG/3dPwnDwAY/abmQODCUd8PdF/fxzBnK9u8e0Rhk6RmN3c7c3GdRuSOkxBf X-Received: by 2002:a63:1d10:: with SMTP id d16-v6mr21974702pgd.228.1541486911379; Mon, 05 Nov 2018 22:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541486911; cv=none; d=google.com; s=arc-20160816; b=SVDDkdwZgSEV84tU9XhSBupdYQyUhhfGLDXwoeenJb7gc1U/n4Tmt4tW5M3VPYCzXL pEtmL7mBzYw9jUy3gXhCEP3j4jdvI2tKOzoeltNFuC74MqKxjwsmdTr6XrK4ElMIJY88 gJtl1KX/txlaR01P6qABCOV/ReIHdvEQDpNmh5HkjEDO93ZrewAtQHZc7xWagiN8Ub11 qnWgUkjBU5PDrNEVReRJenI9pxj6jIPaDcGZ8lzsv7KQYD1AvHxULlay3/Wq8e/CE6R9 31IrX0FiDIQIvRGobdkokQLOI1vWgqmKDeGCzRXa8ZTUJN6RkqZxC9Oy99BT9Lxqaozu 0KJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=S8xC1F6GwJlHiPkz82kfP03UjB9722Mas2Lt+HyGbxw=; b=gMoDr3+er90YS3CR/N6meuf4/aXGitO0Ci3Z73MPHSqxx/EFrk+qWmKoFUHaoV43Qp 5VQe4mChM7LepOLDgCZnSgrP62YCQ3+QgDHKH5FTPKV+UsEcwFqVy/Kf4ytOSUIS2NSo 5thw94i093SZxPPdK+wvcoRUio/4paayEJgaoxpGL4EL6K2wTQXMQS0uwTMiQpB51wn1 IPPNwhisMApsj2e/0pDD4y/z+cPNUBHo7DTUpjAs29bWKGnXabgJ1OuKVBdXj/5T8n2P E2ug+QcxZZYjQrvs0lSva9b3mdrqnsIc5Vc7JtljMO1YGb726iDTAgvl8X4iwlzSQndw 68kQ== 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 u128-v6si44020141pfb.181.2018.11.05.22.48.16; Mon, 05 Nov 2018 22:48:31 -0800 (PST) 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 S2387797AbeKFQLZ (ORCPT + 99 others); Tue, 6 Nov 2018 11:11:25 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:47282 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387593AbeKFQLZ (ORCPT ); Tue, 6 Nov 2018 11:11:25 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 065FA5200306329F6D8F; Tue, 6 Nov 2018 14:47:11 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wA66l5hx044597; Tue, 6 Nov 2018 14:47:05 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018110614471904-8886583 ; Tue, 6 Nov 2018 14:47:19 +0800 From: Peng Hao To: robh+dt@kernel.org, mark.rutland@arm.com, arnd@arndb.de, gregkh@linuxfoundation.org, andy@infradead.org, dvhart@infradead.org Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, hutao@cn.fujitsu.com, linux-doc@vger.kernel.org, Peng Hao Subject: [PATCH v8 02/11] misc/pvpanic: simplify the code using acpi_dev_resource_io Date: Tue, 6 Nov 2018 22:57:13 +0800 Message-Id: <1541516242-98568-2-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1541516242-98568-1-git-send-email-peng.hao2@zte.com.cn> References: <1541516242-98568-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-06 14:47:19, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-06 14:47:01, Serialize complete at 2018-11-06 14:47:01 X-MAIL: mse01.zte.com.cn wA66l5hx044597 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use acpi_dev_resource_io API. Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Acked-by: Mark Rutland Signed-off-by: Peng Hao --- drivers/misc/pvpanic.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c index fd86dab..49c59e1 100644 --- a/drivers/misc/pvpanic.c +++ b/drivers/misc/pvpanic.c @@ -77,17 +77,14 @@ static acpi_status pvpanic_walk_resources(struct acpi_resource *res, void *context) { - switch (res->type) { - case ACPI_RESOURCE_TYPE_END_TAG: - return AE_OK; + struct resource r; - case ACPI_RESOURCE_TYPE_IO: - port = res->data.io.minimum; + if (acpi_dev_resource_io(res, &r)) { + port = r.start; return AE_OK; - - default: - return AE_ERROR; } + + return AE_ERROR; } static int pvpanic_add(struct acpi_device *device) -- 1.8.3.1