Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2012396imu; Thu, 24 Jan 2019 05:56:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN6FisMGPcMw66cIKXV78M8znRGsJk09yuA6/i05qBlZ+xx5R9sGNCV5vBXnS83+6bHqHQZH X-Received: by 2002:a17:902:1d4a:: with SMTP id u10mr6402026plu.122.1548338170148; Thu, 24 Jan 2019 05:56:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548338170; cv=none; d=google.com; s=arc-20160816; b=cU1wAjpC+8pFfX2dMaFYJ3Bd1cqKpZv1hDI5QTswPAh7aSGXE+xsrCKez6uFIRfwpI Bw/S+UBFul7TwQcu9iKOMA+1daKqdr1nrV2HrPoVXcawESzdHDx+Sv0qSwt1DIdYFLYv rngpsF/Z6pl/NfGNsvxuAdJfkYoxH79ujc4PnhtWXBctthatithAV58l2PNPREKQ2VOm kwjKMyyxVAyFbW9InBdu5WWNxFHVo7kAKW1uFFx0LApV99oO8m4Wj3XlQ6tSyYC6UkYz euKvAwjfKjSCDcoXwLJpsFOpsO2BXaM3haUap/cLqc8MWL9E7Muilmr29csjSlERxLSY sHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=EbTS8gtA6QW4i2cki4shNKVbxPliEiep2OQfHxht0vU=; b=FSdig32QIm/ykuWzVnlvQATolaaaAgjW/BRj7LU9JU4TAsS9HyqJORALfGDxdBNNmC HqMSl4GY9ZY1Ho3lpepJKe9PpVrnrAlmmx+qlwFBwSH2u2airPbH9tGtEzNmHwwloLng fl0DKA2A04QpSNHidFi+W5w8j4KWYr/3hm+t2WdbPdSwjDsP1T9xU0IAm0bn2FuDnn5v lVNsgBn/VuGHm9pFQacBvvnvtWe8proq6XHWl+Rdah4JTxbHNYSWi3Zzo1aCIz3u3qM6 25MM9t3FRqU3gHRSIux3p7AXCg42ckQGY2kAfzTUgqsuGZ52/UuSzq636lpsFdADev4M oihg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IBYF/Ca3"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si23325716pld.252.2019.01.24.05.55.54; Thu, 24 Jan 2019 05:56:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IBYF/Ca3"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728137AbfAXNzE (ORCPT + 99 others); Thu, 24 Jan 2019 08:55:04 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43781 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726105AbfAXNzE (ORCPT ); Thu, 24 Jan 2019 08:55:04 -0500 Received: by mail-pf1-f194.google.com with SMTP id w73so3009370pfk.10 for ; Thu, 24 Jan 2019 05:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EbTS8gtA6QW4i2cki4shNKVbxPliEiep2OQfHxht0vU=; b=IBYF/Ca31TPPYXP5VdmFCpGG36O38zp44Oc4Ak6qI7r2l51loPB/+v4WAdYxXakMwS VqxVNSexJvEZxStYby2QgoFL3xjU9GH7F8UmAHqHGYOpgVNQ8ykPUm+cJ6Mseu6QR28q sXUlNF9OIlUFggKoAwFuLuuSvNtwprQBIpriAM6zEUUIu1bhsyqd0SRyWWrVT7N9Le2r LcFLRka9uqyytdjaErYYmYYuRkx3XDlRt211h3Yx1/a8KiAw4CKSqoNHStq2TSEFTe9B Ht2GYiCOEWeT/Wh/nBRl2MqnPpX/j0tnLTxmipCc5yey+A+tYCaH1E8pbm890MmJLs+e J9Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EbTS8gtA6QW4i2cki4shNKVbxPliEiep2OQfHxht0vU=; b=iXqMVYyGjA7rq1egmSHPA0HmOsd/Fso8hl29mRhOMMh2tZ82cbhAfSLMiTo5qh4VUj 3265RhIbJ187fHWpIIcoQnVPA5mKnvf3iITueapsrNeBmmuYo1eNn0Tgw/5M6TmExYWM 6vAjKxVwZVOXJbFsIHfLZ1MWaMfN+uZmEZg/hGU+P2w0E963mq1AI8oGhZP3pXOV8uHy RnVBtEf7JP59fBH7ysOHna/dfKya6JHV6lVTqWgPTb3eHvaZzf4wzUYniK3sf+KXHNCM 3cmLqU5iCFB8TPr/4tr0ZYCgV4rPiRur338sGRgwT37Om7yKSJeqi8FR98lVvc7U+Mto 74TQ== X-Gm-Message-State: AJcUukceyMPn7FMF5QnVMeWc7YdWHPNe7AbJSrO1ZD4iJrWC0Fh3fYc4 D+VtqUBLWnlnxsai6e18JOVeyzD2+D9UXbjQuW4= X-Received: by 2002:a62:34c6:: with SMTP id b189mr6724933pfa.229.1548338103400; Thu, 24 Jan 2019 05:55:03 -0800 (PST) MIME-Version: 1.0 References: <1548348038-69560-1-git-send-email-peng.hao2@zte.com.cn> <1548348038-69560-5-git-send-email-peng.hao2@zte.com.cn> In-Reply-To: <1548348038-69560-5-git-send-email-peng.hao2@zte.com.cn> From: Andy Shevchenko Date: Thu, 24 Jan 2019 15:54:52 +0200 Message-ID: Subject: Re: [PATCH V4 4/6] misc/pvpanic: add pvpanic acpi driver To: Peng Hao Cc: Greg Kroah-Hartman , Arnd Bergmann , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 24, 2019 at 10:17 AM Peng Hao wrote: > > Make pvpanic acpi driver as separate file and modify code > in order to adapt the framework. This should be patch 2 in this series to avoid run-time bisectability issues. > > Signed-off-by: Peng Hao > --- > drivers/misc/pvpanic/Kconfig | 13 +++++++ > drivers/misc/pvpanic/Makefile | 1 + > drivers/misc/pvpanic/pvpanic-acpi.c | 77 +++++++++++++++++++++++++++++++++++++ > 3 files changed, 91 insertions(+) > create mode 100644 drivers/misc/pvpanic/pvpanic-acpi.c > > diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig > index 3e612c6..1dcfe20 100644 > --- a/drivers/misc/pvpanic/Kconfig > +++ b/drivers/misc/pvpanic/Kconfig > @@ -5,3 +5,16 @@ config PVPANIC > This driver provides support for the pvpanic device. pvpanic is > a paravirtualized device provided by QEMU; it lets a virtual machine > (guest) communicate panic events to the host. > + > +if PVPANIC > + > +config PVPANIC_ACPI > + tristate "pvpanic acpi driver" > + depends on ACPI > + default PVPANIC > + help > + This driver is one specific driver for pvpanic driver framework. > + It provides an acpi device as pvpanic device. > + > +endif > + > diff --git a/drivers/misc/pvpanic/Makefile b/drivers/misc/pvpanic/Makefile > index 6394224..c5b73ca 100644 > --- a/drivers/misc/pvpanic/Makefile > +++ b/drivers/misc/pvpanic/Makefile > @@ -3,3 +3,4 @@ > # Copyright (c) 2018 ZTE Ltd. > > obj-$(CONFIG_PVPANIC) += pvpanic.o > +obj-$(CONFIG_PVPANIC_ACPI) += pvpanic-acpi.o > diff --git a/drivers/misc/pvpanic/pvpanic-acpi.c b/drivers/misc/pvpanic/pvpanic-acpi.c > new file mode 100644 > index 0000000..8d10924 > --- /dev/null > +++ b/drivers/misc/pvpanic/pvpanic-acpi.c > @@ -0,0 +1,77 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * pvpanic acpi driver. > + * > + * Copyright (C) 2019 ZTE Ltd. > + * Author: Peng Hao > + */ > +#include > +#include > +#include > +#include > +#include "pvpanic.h" > + > +static int pvpanic_add(struct acpi_device *device); > +static int pvpanic_remove(struct acpi_device *device); > + > +static const struct acpi_device_id pvpanic_device_ids[] = { > + { "QEMU0001", 0 }, > + { "", 0 } > +}; > +MODULE_DEVICE_TABLE(acpi, pvpanic_device_ids); > + > +static struct acpi_driver pvpanic_driver = { > + .name = "pvpanic", > + .class = "QEMU", > + .ids = pvpanic_device_ids, > + .ops = { > + .add = pvpanic_add, > + .remove = pvpanic_remove, > + }, > + .owner = THIS_MODULE, > +}; > + > +static acpi_status > +pvpanic_walk_resources(struct acpi_resource *res, void *context) > +{ > + struct resource r; > + int ret = 0; > + struct device *dev = context; > + > + memset(&r, 0, sizeof(r)); > + if (acpi_dev_resource_io(res, &r) || acpi_dev_resource_memory(res, &r)) > + ret = pvpanic_add_device(dev, &r); > + > + if (!ret) > + return AE_OK; > + > + return AE_ERROR; > +} > +static int pvpanic_add(struct acpi_device *device) > +{ > + int ret; > + acpi_status status; > + > + ret = acpi_bus_get_status(device); > + if (ret < 0) > + return ret; > + > + if (!device->status.enabled || !device->status.functional) > + return -ENODEV; > + > + status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, > + pvpanic_walk_resources, &device->dev); > + > + if (ACPI_FAILURE(status)) > + return -ENODEV; > + > + return 0; > +} > + > +static int pvpanic_remove(struct acpi_device *device) > +{ > + pvpanic_remove_device(); > + return 0; > +} > + > +module_acpi_driver(pvpanic_driver); > -- > 1.8.3.1 > -- With Best Regards, Andy Shevchenko