Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1525699
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v16 11/15] acpi/arm64: Add GTDT table parse driver |
| Date | 2016-11-18 21:20 +0100 |
| Message-ID | <sEXND-3s3-17@gated-at.bofh.it> (permalink) |
| References | <sE8L7-3uw-15@gated-at.bofh.it> <sE8UO-3xZ-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Nov 16, 2016 at 09:49:04PM +0800, fu.wei@linaro.org wrote:
> +#define for_each_platform_timer(_g) for (; _g; _g = next_platform_timer(_g))
This doesn't fit the usual for_each_* pattern, since _g has to be
manually initialised first. Either come up with a way of maknig this fit
the usual pattern, or get rid of this, and use:
t = however_you_get_the_first_timer();
if (!t)
bailt_out_somehow();
do {
...
} while (t = next_platform_timer(t));
> +/*
> + * Release the memory we have allocated in acpi_gtdt_init.
> + * This should be called, when the driver who called "acpi_gtdt_init" previously
> + * doesn't need the GTDT info anymore.
> + */
> +void __init acpi_gtdt_release(void)
> +{
> + kfree(timer_block);
> + kfree(watchdog);
> + timer_block = NULL;
> + watchdog = NULL;
> +}
Why is this not simply in the error path of acpi_gtdt_init()?
> +
> +/*
> + * Get some basic info from GTDT table, and init the global variables above
> + * for all timers initialization of Generic Timer.
> + * This function does some validation on GTDT table.
> + */
> +int __init acpi_gtdt_init(struct acpi_table_header *table)
> +{
> + timer_block = kcalloc(timer_count,
> + sizeof(struct acpi_gtdt_timer_block *),
> + GFP_KERNEL);
> + if (!timer_block)
> + return -ENOMEM;
> +
> + watchdog = kcalloc(timer_count, sizeof(struct acpi_gtdt_watchdog *),
> + GFP_KERNEL);
> + if (!watchdog) {
> + kfree(timer_block);
> + timer_block = NULL;
> + return -ENOMEM;
> + }
Please have a common error path below, and branch to that when you need
to free these.
> +error:
> + acpi_gtdt_release();
> + return -EINVAL;
> +}
[...]
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 61a3d90..a1611d1 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -577,6 +577,13 @@ enum acpi_reconfig_event {
> int acpi_reconfig_notifier_register(struct notifier_block *nb);
> int acpi_reconfig_notifier_unregister(struct notifier_block *nb);
>
> +#ifdef CONFIG_ACPI_GTDT
> +int acpi_gtdt_init(struct acpi_table_header *table);
> +int acpi_gtdt_map_ppi(int type);
> +bool acpi_gtdt_c3stop(int type);
> +void acpi_gtdt_release(void);
Why do these need to be here?
What possible value is ther in exporting acpi_gtdt_release() !?
Thanks,
Mark.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer fu.wei@linaro.org - 2016-11-16 14:50 +0100
[PATCH v16 07/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_detect_rate to keep dt code in *_of_init fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 07/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_detect_rate to keep dt code in *_of_init Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:00 +0100
Re: [PATCH v16 07/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_detect_rate to keep dt code in *_of_init Fu Wei <fu.wei@linaro.org> - 2016-11-21 15:10 +0100
[PATCH v16 12/15] clocksource/drivers/arm_arch_timer: Simplify ACPI support code. fu.wei@linaro.org - 2016-11-16 15:00 +0100
[PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in GTDT driver fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in GTDT driver Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-11-18 15:30 +0100
Re: [PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in GTDT driver Fu Wei <fu.wei@linaro.org> - 2016-11-23 13:00 +0100
Re: [PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in GTDT driver Fu Wei <fu.wei@linaro.org> - 2016-11-24 05:00 +0100
[PATCH v16 10/15] clocksource/drivers/arm_arch_timer: Refactor the timer init code to prepare for GTDT fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 10/15] clocksource/drivers/arm_arch_timer: Refactor the timer init code to prepare for GTDT Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:10 +0100
Re: [PATCH v16 10/15] clocksource/drivers/arm_arch_timer: Refactor the timer init code to prepare for GTDT Fu Wei <fu.wei@linaro.org> - 2016-11-23 07:20 +0100
[PATCH v16 11/15] acpi/arm64: Add GTDT table parse driver fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 11/15] acpi/arm64: Add GTDT table parse driver Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:20 +0100
Re: [PATCH v16 11/15] acpi/arm64: Add GTDT table parse driver Fu Wei <fu.wei@linaro.org> - 2016-11-23 13:10 +0100
[PATCH v16 04/15] clocksource/drivers/arm_arch_timer: rename some enums and defines, and some cleanups. fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 04/15] clocksource/drivers/arm_arch_timer: rename some enums and defines, and some cleanups. Mark Rutland <mark.rutland@arm.com> - 2016-11-18 20:00 +0100
Re: [PATCH v16 04/15] clocksource/drivers/arm_arch_timer: rename some enums and defines, and some cleanups. Fu Wei <fu.wei@linaro.org> - 2016-11-21 07:20 +0100
[PATCH v16 01/15] clocksource/drivers/arm_arch_timer: Move enums and defines to header file fu.wei@linaro.org - 2016-11-16 15:00 +0100
[PATCH v16 15/15] acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver fu.wei@linaro.org - 2016-11-16 15:00 +0100
[PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:30 +0100
Re: [PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer Fu Wei <fu.wei@linaro.org> - 2016-11-23 13:20 +0100
[PATCH v16 08/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_needs_probing, and call it only if acpi disabled. fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 08/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_needs_probing, and call it only if acpi disabled. Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:00 +0100
Re: [PATCH v16 08/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_needs_probing, and call it only if acpi disabled. Fu Wei <fu.wei@linaro.org> - 2016-11-21 15:40 +0100
[PATCH v16 06/15] clocksource/drivers/arm_arch_timer: separate out arch_timer_uses_ppi init code to prepare for GTDT. fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 06/15] clocksource/drivers/arm_arch_timer: separate out arch_timer_uses_ppi init code to prepare for GTDT. Mark Rutland <mark.rutland@arm.com> - 2016-11-18 20:40 +0100
Re: [PATCH v16 06/15] clocksource/drivers/arm_arch_timer: separate out arch_timer_uses_ppi init code to prepare for GTDT. Fu Wei <fu.wei@linaro.org> - 2016-11-21 10:50 +0100
[PATCH v16 03/15] clocksource/drivers/arm_arch_timer: Improve printk relevant code fu.wei@linaro.org - 2016-11-16 15:00 +0100
[PATCH v16 02/15] clocksource/drivers/arm_arch_timer: Add a new enum for spi type fu.wei@linaro.org - 2016-11-16 15:00 +0100
[PATCH v16 09/15] clocksource/drivers/arm_arch_timer: Introduce some new structs to prepare for GTDT fu.wei@linaro.org - 2016-11-16 15:00 +0100
[PATCH v16 05/15] clocksource/drivers/arm_arch_timer: fix a bug in arch_timer_register about arch_timer_uses_ppi fu.wei@linaro.org - 2016-11-16 15:00 +0100
Re: [PATCH v16 05/15] clocksource/drivers/arm_arch_timer: fix a bug in arch_timer_register about arch_timer_uses_ppi Mark Rutland <mark.rutland@arm.com> - 2016-11-18 20:00 +0100
Re: [PATCH v16 05/15] clocksource/drivers/arm_arch_timer: fix a bug in arch_timer_register about arch_timer_uses_ppi Fu Wei <fu.wei@linaro.org> - 2016-11-21 08:40 +0100
Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer Xiongfeng Wang <wangxiongfeng2@huawei.com> - 2016-11-17 04:50 +0100
Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer Xiongfeng Wang <wangxiongfeng2@huawei.com> - 2016-11-17 10:40 +0100
Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer Fu Wei <fu.wei@linaro.org> - 2016-11-17 12:20 +0100
Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-11-17 10:50 +0100
csiph-web