Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp473114imu; Tue, 22 Jan 2019 23:26:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN4bOMWC5qauetn7thB2DbQ2HhT49wCueTgE6wIbd+hC8+QhLH1bhEd5dyxpIa8IIsKoau2X X-Received: by 2002:a63:981:: with SMTP id 123mr1051896pgj.444.1548228364003; Tue, 22 Jan 2019 23:26:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548228363; cv=none; d=google.com; s=arc-20160816; b=kAaIvjsSae+lrNBaY/mtHm61qcqlUDlB0oRuZ8BDqf8ekAz45Zf+9YPaKuW6XepJs5 zf4NKMYCwc0xtKLmglc/SB48MguNxeKE8nJqLx8iqGjXFT2lJKj0prwxPav2L8b7sNBH mQXuLEHj7cAu+xicD+DAd8Jk3Gb29zNKTTVIl48MJbqPHEnbz4Zg09oGYyd4SQrj0QhD 8E115vudTJbSzz8hZsx3qsk4h49VNwdAPNVxzQLMG+zl/AJ+5fbzc/gJwCsfErN+cAk0 y+UZkpmGcQlU2hL6e/dcwhDswqry4J+omv7NQkGpI3wOmKMvRRoKAcJzgv+quMTCQ+v8 KLHg== 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=/dg6uDq7qf0zUSYAcsTvolUb4u9WUwkrx6K5Jhno99g=; b=DpWnLWOpEooQbTdjPh+ES2kx7hIVVL0aJ3ZiTaNJhJir8mYl56wnCgeCWhTKyBomQ0 0Yjk3fS1EXkwelkTddRLPW5+U3vlpYyxNXKr79TUcbC/p/w7nUjAMv90vSFfdGav2ojj qouddzzg6+2oNvNOKmjwYhNL8gga2RT/e+vj98AQfsukaSYhV0PuwKQJStlbLygs6uCO 4U2c4xTq8aNDOli4U3NxLN1X0Kb7sSDjxCc/bNqgyi0BZSG36dRaKBuvVhz0+7Lwk3xc Gv5S8WqgZBcqsiCQ0D5dHyrwZhgeYa+E5q0AAkIrKBG/xHG+s/NHjWK+33ZA1fiKA2uU NfMw== 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 b61si18699117plb.70.2019.01.22.23.25.48; Tue, 22 Jan 2019 23:26:03 -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 S1726964AbfAWHYj (ORCPT + 99 others); Wed, 23 Jan 2019 02:24:39 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:16536 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbfAWHYh (ORCPT ); Wed, 23 Jan 2019 02:24:37 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id BB522D430BFDCCC2A050; Wed, 23 Jan 2019 15:24:36 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x0N7OROg027511; Wed, 23 Jan 2019 15:24:27 +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 2019012315244960-23701706 ; Wed, 23 Jan 2019 15:24:49 +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 V3 5/6] misc/pvpanic: add pvpanic mmio driver Date: Wed, 23 Jan 2019 23:47:27 +0800 Message-Id: <1548258448-62013-6-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548258448-62013-1-git-send-email-peng.hao2@zte.com.cn> References: <1548258448-62013-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-23 15:24:49, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-01-23 15:24:20, Serialize complete at 2019-01-23 15:24:20 X-MAIL: mse01.zte.com.cn x0N7OROg027511 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make pvpanic mmio driver as seperate file and modify code in order to adapt the framework. Signed-off-by: Peng Hao --- drivers/misc/pvpanic/Kconfig | 4 +++ drivers/misc/pvpanic/Makefile | 1 + drivers/misc/pvpanic/pvpanic-of.c | 53 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 drivers/misc/pvpanic/pvpanic-of.c diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig index d274130..47f8709 100644 --- a/drivers/misc/pvpanic/Kconfig +++ b/drivers/misc/pvpanic/Kconfig @@ -13,4 +13,8 @@ config PVPANIC_ACPI depends on ACPI default PVPANIC +config PVPANIC_OF + tristate "pvpanic mmio driver" + depends on OF + 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+ +/* + * 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