Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1721194imu; Thu, 24 Jan 2019 00:18:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN5OB3T+PBSdwMpL2puyBCnCZlgLvFzvpG8OVVpILBh2EHPwnv3BfsKD+ebQv0Pdl22sQ+KM X-Received: by 2002:a63:88c7:: with SMTP id l190mr4995730pgd.110.1548317900406; Thu, 24 Jan 2019 00:18:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548317900; cv=none; d=google.com; s=arc-20160816; b=ftm9uZsukoriQXdh77CHqZbQYksc9hFGgPNUyQy8TDWt6yoloCVyP6n5o1e1pceQep etiLE7TDd4VlTumO49dUED9pPq7lbH9iZQIfdHeNelOP79ywLQucNKXzl1NxgyaVtUgO zDErgw2GzKAot5jGLQzl1MnQf+VP/RQHj+zYNENv6Hh4PvPIKFEe1cCs6mrM8N5Xs5CY 9iiInFhHY1WRDnpLWmWbjBItzpBZPyf89PbClu5fErjJK6EbIivw37wvoXdY5EE0SIHa KFuhMFnTVvlDuoesiOy/nN8xMVbRxAz/fMqyX1djwGxf+w5ZGZoo44/ejie6UMb9P+wk Yupg== 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=/brWPOpD7cyVSKPbmYupMQtCLrn7T+wVw/ZaQwNhJEY=; b=Aa/dtGOtvu5Sa1vVd9ku6wTE8eilU7mtEJ02o2prFU9vLVxPP0TrdlEJnpMP76tTG7 sSpIbg9lHrnuif34TZnWna/NggP9GOSmvSFGJCkthAN3iDjHpZrj/Db0vFyTS/wCglLh rGjbRAyG0kxX32KZdWgxBHnRdT4clfgPX1zILypQkTjtRI3uozLvvTA3Kx2sNplWBACP HIE0KRAMofqXBPZnXfqBHDx+yLVpJjXwB4CjD8Bw342QO0jbM4cIeSQSjuBoIguWCX0r B1J47Uxyc2m/YE6xcVFxIO5BDIIDOM5ShmLtENmVCUBpffYnOddHBpdGQcHt+Gdjhx0S M3Mg== 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 l7si20215853pfg.245.2019.01.24.00.18.05; Thu, 24 Jan 2019 00:18:20 -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 S1727545AbfAXIRs (ORCPT + 99 others); Thu, 24 Jan 2019 03:17:48 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:5436 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726337AbfAXIRq (ORCPT ); Thu, 24 Jan 2019 03:17:46 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 66463293E032975305C5; Thu, 24 Jan 2019 16:17:44 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x0O8HWI4030957; Thu, 24 Jan 2019 16:17:32 +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 2019012416180276-23928001 ; Thu, 24 Jan 2019 16:18:02 +0800 From: Peng Hao To: gregkh@linuxfoundation.org, arnd@arndb.de, andy.shevchenko@gmail.com Cc: linux-kernel@vger.kernel.org, Peng Hao Subject: [PATCH V4 5/6] misc/pvpanic: add pvpanic mmio driver Date: Fri, 25 Jan 2019 00:40:37 +0800 Message-Id: <1548348038-69560-6-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548348038-69560-1-git-send-email-peng.hao2@zte.com.cn> References: <1548348038-69560-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 2019-01-24 16:18:02, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-01-24 16:17:21, Serialize complete at 2019-01-24 16:17:21 X-MAIL: mse01.zte.com.cn x0O8HWI4030957 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make pvpanic mmio driver as separate file and modify code in order to adapt the framework. Signed-off-by: Peng Hao --- drivers/misc/pvpanic/Kconfig | 7 ++++++ drivers/misc/pvpanic/Makefile | 1 + drivers/misc/pvpanic/pvpanic-of.c | 53 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 drivers/misc/pvpanic/pvpanic-of.c diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig index 1dcfe20..14074af 100644 --- a/drivers/misc/pvpanic/Kconfig +++ b/drivers/misc/pvpanic/Kconfig @@ -16,5 +16,12 @@ config PVPANIC_ACPI This driver is one specific driver for pvpanic driver framework. It provides an acpi device as pvpanic device. +config PVPANIC_OF + tristate "pvpanic mmio driver" + depends on OF + help + This driver is one specific driver for pvpanic driver framework. + It provides a mmio device as pvpanic device. + endif diff --git a/drivers/misc/pvpanic/Makefile b/drivers/misc/pvpanic/Makefile index c5b73ca..63ef0db 100644 --- a/drivers/misc/pvpanic/Makefile +++ b/drivers/misc/pvpanic/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_PVPANIC_ACPI) += pvpanic-acpi.o +obj-$(CONFIG_PVPANIC_OF) += pvpanic-of.o diff --git a/drivers/misc/pvpanic/pvpanic-of.c b/drivers/misc/pvpanic/pvpanic-of.c new file mode 100644 index 0000000..73ca5f3 --- /dev/null +++ b/drivers/misc/pvpanic/pvpanic-of.c @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * pvpanic of driver. + * + * Copyright (C) 2019 ZTE Ltd. + * Author: Peng Hao + */ + +#include +#include +#include +#include +#include +#include +#include "pvpanic.h" + +static int pvpanic_mmio_probe(struct platform_device *pdev) +{ + struct resource *res; + int ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + + ret = pvpanic_add_device(&pdev->dev, res); + if (ret) + return -ENODEV; + + return 0; +} + +static int pvpanic_mmio_remove(struct platform_device *pdev) +{ + pvpanic_remove_device(); + return 0; +} + +static const struct of_device_id pvpanic_mmio_match[] = { + { .compatible = "qemu,pvpanic-mmio", }, + {} +}; + +static struct platform_driver pvpanic_mmio_driver = { + .driver = { + .name = "pvpanic-mmio", + .of_match_table = pvpanic_mmio_match, + }, + .probe = pvpanic_mmio_probe, + .remove = pvpanic_mmio_remove, +}; + +module_platform_driver(pvpanic_mmio_driver); -- 1.8.3.1