From: Andi Kleen <andi@firstfloor.org>
To: "Ângelo Miguel Arrifano" <miknix@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>, Zhang Rui <rui.zhang@intel.com>,
Len Brown <lenb@kernel.org>, "Li, Shaohua" <shaohua.li@intel.com>,
linux-acpi@vger.kernel.org
Subject: Re: [PATCH] ACPI: Platform driver to support App Hot Startup (PNP0C32)
Date: Thu, 28 Aug 2008 17:36:42 +0200 [thread overview]
Message-ID: <20080828153642.GP26610@one.firstfloor.org> (raw)
In-Reply-To: <20080828154745.0ccf261b.miknix@gmail.com>
On Thu, Aug 28, 2008 at 03:47:45PM +0200, Ângelo Miguel Arrifano wrote:
> On Thu, 28 Aug 2008 15:08:05 +0200
> Andi Kleen <andi@firstfloor.org> wrote:
>
> > > Ok thanks, here it is.
> >
> > Please submit it with proper description and Signed-off-by lines.
> > (see Documentation/SubmittingPatches)
> >
> > -Andi
Quick review:
Need a title (one line description)
Best probably you run it through checkpatch.pl and fix the warnings
and possibly also Lindent.
> index c52fca8..ed48a56 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -199,6 +199,14 @@ config ACPI_THERMAL
> recommended that this option be enabled, as your processor(s)
> may be damaged without it.
>
> +config ACPI_QUICKSTART
> + tristate "Quickstart"
> + default m
Please remove the default m
Also I think the position is wrong, this should be further down with
other misc ACPI drivers.
> +
> +#define QUICKSTART_PF_DRIVER_NAME "quickstart"
> +#define QUICKSTART_PF_DEVICE_NAME "quickstart"
> +#define QUICKSTART_PF_DEVATTR_NAME "pressed_button"
I don't see the point of these defines. Can you just expand
them please?
> +
> +/*
> + * ACPI driver Structs
> + */
> +
> +struct quickstart_acpi {
> + struct acpi_device *device;
> + struct quickstart_btn *btn;
> +};
There should be a new line here.
> +static int quickstart_acpi_add(struct acpi_device *device);
> +static int quickstart_acpi_remove(struct acpi_device *device, int type);
Standard practice is to reorder the file that forward declarations
are not needed.
> +
> +static struct acpi_driver quickstart_acpi_driver = {
> + .name = "quickstart",
> + .class = QUICKSTART_ACPI_CLASS,
> + .ids = quickstart_device_ids,
> + .ops = {
> + .add = quickstart_acpi_add,
> + .remove = quickstart_acpi_remove,
Unusual indentation.
> + },
> +};
> +
> +/*
> + * Platform driver structs
> + */
> +static ssize_t buttons_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf);
> +static ssize_t pressed_button_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf);
> +static ssize_t pressed_button_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf,
> + size_t count);
See above for forward declarations.
> + */
> +static ssize_t buttons_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + int count = 0;
> + struct quickstart_btn *ptr = quickstart_data.btn_lst;
> +
> + if (!ptr)
> + return snprintf(buf, PAGE_SIZE, "none");
> +
> + while (ptr && (count < PAGE_SIZE)) {
> + if (ptr->name) {
> + count += snprintf(buf + count,
> + PAGE_SIZE - count,
> + "%s\n", ptr->name);
> + }
> + ptr = ptr->next;
> + }
Is it guaranteed that list is always shorter than
PAGE_SIZE? PAGE_SIZE - count might go negative otherwise
and snprintf will not handle that. Should be some proper limit.
> +
> +
> +static ssize_t pressed_button_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + if (count < 2)
> + return -EINVAL;
Check is redundant.
> +
> + if (strncasecmp(buf, "none", 4) != 0)
> + return -EINVAL;
> +
> + quickstart_data.pressed = NULL;
> + return count;
> +}
> +
> +/* Hotstart Helper functions */
> +static int quickstart_btnlst_add(struct quickstart_btn **data)
> +{
> + struct quickstart_btn **ptr = &quickstart_data.btn_lst;
> +
> + while (*ptr)
> + ptr = &((*ptr)->next);
Would be all clearer if you used standard list.h lists.
> + ret = quickstart_btnlst_add(&quickstart->btn);
> + if (ret)
> + return ret;
> +
> + quickstart->btn->name = kzalloc(len + 1, GFP_KERNEL);
> + if (!quickstart->btn->name) {
> + quickstart_btnlst_free();
> + return -ENOMEM;
> + }
> + strcpy(quickstart->btn->name, bid);
Use kstrndup()
> +
> + platform_device_unregister(pf_device);
> +
> + platform_driver_unregister(&pf_driver);
> +
> + acpi_bus_unregister_driver(&quickstart_acpi_driver);
> +
> + quickstart_btnlst_free();
> +
> + return;
You have a lot of stray such returns; Remove them all.
> Signed-off-by: Angelo Miguel Arrifano <miknix@gmail.com>
That should be at the bottom of the description.
-Andi
--
ak@linux.intel.com
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-08-28 15:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-14 15:17 [PATCH] ACPI: Platform driver to support App Hot Startup (PNP0C32) Ângelo Miguel Arrifano
2008-03-25 6:59 ` Zhang, Rui
2008-03-26 17:51 ` Ângelo Miguel Arrifano
2008-03-27 2:30 ` Shaohua Li
2008-03-27 16:03 ` Ângelo Miguel Arrifano
2008-03-28 1:36 ` Shaohua Li
2008-03-28 19:39 ` Ângelo Miguel Arrifano
2008-08-24 16:39 ` Ângelo Miguel Arrifano
2008-08-25 1:29 ` Zhang Rui
2008-08-26 18:43 ` Andi Kleen
2008-08-28 12:37 ` Ângelo Miguel Arrifano
2008-08-28 13:08 ` Andi Kleen
2008-08-28 13:47 ` Ângelo Miguel Arrifano
2008-08-28 15:36 ` Andi Kleen [this message]
2008-08-28 13:40 ` Matthew Garrett
2008-08-31 22:38 ` Ângelo Miguel Arrifano
2008-08-31 22:00 ` Matthew Garrett
2008-08-31 23:21 ` Ângelo Miguel Arrifano
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=20080828153642.GP26610@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=miknix@gmail.com \
--cc=rui.zhang@intel.com \
--cc=shaohua.li@intel.com \
/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