From: Greg KH <gregkh@linuxfoundation.org>
To: Peng Hao <peng.hao2@zte.com.cn>
Cc: arnd@arndb.de, andy.shevchenko@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] misc/pvpanic: add API for pvpanic driver framework
Date: Tue, 22 Jan 2019 10:38:58 +0100 [thread overview]
Message-ID: <20190122093858.GB29657@kroah.com> (raw)
In-Reply-To: <1548098711-52497-3-git-send-email-peng.hao2@zte.com.cn>
On Tue, Jan 22, 2019 at 03:25:08AM +0800, Peng Hao wrote:
> Add pvpanic_add/remove_device API.
That says what you are doing, but not _why_ you need to do this.
Why?
>
> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> ---
> drivers/misc/pvpanic/pvpanic.c | 32 ++++++++++++++++++++++++++++++++
> drivers/misc/pvpanic/pvpanic.h | 14 ++++++++++++++
> 2 files changed, 46 insertions(+)
> create mode 100644 drivers/misc/pvpanic/pvpanic.h
>
> diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
> index 227ab4e..f842ee4 100644
> --- a/drivers/misc/pvpanic/pvpanic.c
> +++ b/drivers/misc/pvpanic/pvpanic.c
> @@ -48,6 +48,38 @@
> .priority = 1, /* let this called before broken drm_fb_helper */
> };
>
> +int pvpanic_add_device(struct device *dev, struct resource *res)
> +{
> + struct platform_device *pdev;
> + int ret;
> +
> + pdev = platform_device_alloc("pvpanic", -1);
> + if (!pdev)
> + return -ENOMEM;
> +
> + pdev->dev.parent = dev;
> +
> + ret = platform_device_add_resources(pdev, res, 1);
> + if (ret)
> + goto err;
> +
> + ret = platform_device_add(pdev);
> + if (ret)
> + goto err;
> + pvpanic_data.pdev = pdev;
> +
> + return 0;
> +err:
> + platform_device_put(pdev);
> + return -1;
> +}
> +
> +void pvpanic_remove_device(void)
> +{
> + platform_device_unregister(pvpanic_data.pdev);
> + pvpanic_data.pdev = NULL;
> +}
> +
> static int pvpanic_platform_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> diff --git a/drivers/misc/pvpanic/pvpanic.h b/drivers/misc/pvpanic/pvpanic.h
> new file mode 100644
> index 0000000..a72ca59
> --- /dev/null
> +++ b/drivers/misc/pvpanic/pvpanic.h
> @@ -0,0 +1,14 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
Do you really mean or later? I have to ask, sorry.
> +/* pvpanic driver framework header file
> + *
> + * Copyright (C) 2019 ZTE Ltd.
> + * Author: Peng Hao <peng.hao2@zte.com.cn>
> + */
> +
> +#ifndef __DRIVERS_MISC_PVPANIC_H
> +#define __DRIVERS_MISC_PVPANIC_H
> +
> +extern int pvpanic_add_device(struct device *dev, struct resource *res);
> +extern void pvpanic_remove_device(void);
No need for "extern", and why have these functions here if no one is
using them?
thanks,
greg k-h
next prev parent reply other threads:[~2019-01-22 9:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 19:25 [PATCH 1/6] misc/pvpanic : preparing for pvpanic driver framework Peng Hao
2019-01-21 19:25 ` [PATCH 2/6] misc/pvpanic: Add " Peng Hao
2019-01-22 9:37 ` Greg KH
2019-01-21 19:25 ` [PATCH 3/6] misc/pvpanic: add API for " Peng Hao
2019-01-22 9:38 ` Greg KH [this message]
2019-01-21 19:25 ` [PATCH 4/6] misc/pvpanic : add pvpanic acpi driver Peng Hao
2019-01-22 9:40 ` Greg KH
2019-01-21 19:25 ` [PATCH 5/6] misc/pvpanic: add pvpanic mmio driver Peng Hao
2019-01-22 9:40 ` Greg KH
2019-01-21 19:25 ` [PATCH 6/6] misc/pvpanic : add pvpanic pci driver Peng Hao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190122093858.GB29657@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=andy.shevchenko@gmail.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.hao2@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox