mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-03-03 18:28:01 +01:00
This was done entirely with mindless brute force, using
git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'
to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.
Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.
For the same reason the 'flex' versions will be done as a separate
conversion.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
111 lines
2.4 KiB
C
111 lines
2.4 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Cirrus Logic CLPS711X clocksource driver
|
|
*
|
|
* Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
|
|
*/
|
|
|
|
#include <linux/clk.h>
|
|
#include <linux/clockchips.h>
|
|
#include <linux/clocksource.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/io.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/of_irq.h>
|
|
#include <linux/sched_clock.h>
|
|
#include <linux/slab.h>
|
|
|
|
enum {
|
|
CLPS711X_CLKSRC_CLOCKSOURCE,
|
|
CLPS711X_CLKSRC_CLOCKEVENT,
|
|
};
|
|
|
|
static void __iomem *tcd;
|
|
|
|
static u64 notrace clps711x_sched_clock_read(void)
|
|
{
|
|
return ~readw(tcd);
|
|
}
|
|
|
|
static void __init clps711x_clksrc_init(struct clk *clock, void __iomem *base)
|
|
{
|
|
unsigned long rate = clk_get_rate(clock);
|
|
|
|
tcd = base;
|
|
|
|
clocksource_mmio_init(tcd, "clps711x-clocksource", rate, 300, 16,
|
|
clocksource_mmio_readw_down);
|
|
|
|
sched_clock_register(clps711x_sched_clock_read, 16, rate);
|
|
}
|
|
|
|
static irqreturn_t clps711x_timer_interrupt(int irq, void *dev_id)
|
|
{
|
|
struct clock_event_device *evt = dev_id;
|
|
|
|
evt->event_handler(evt);
|
|
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
static int __init _clps711x_clkevt_init(struct clk *clock, void __iomem *base,
|
|
unsigned int irq)
|
|
{
|
|
struct clock_event_device *clkevt;
|
|
unsigned long rate;
|
|
|
|
clkevt = kzalloc_obj(*clkevt);
|
|
if (!clkevt)
|
|
return -ENOMEM;
|
|
|
|
rate = clk_get_rate(clock);
|
|
|
|
/* Set Timer prescaler */
|
|
writew(DIV_ROUND_CLOSEST(rate, HZ), base);
|
|
|
|
clkevt->name = "clps711x-clockevent";
|
|
clkevt->rating = 300;
|
|
clkevt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_C3STOP;
|
|
clkevt->cpumask = cpumask_of(0);
|
|
clockevents_config_and_register(clkevt, HZ, 0, 0);
|
|
|
|
return request_irq(irq, clps711x_timer_interrupt, IRQF_TIMER,
|
|
"clps711x-timer", clkevt);
|
|
}
|
|
|
|
static int __init clps711x_timer_init(struct device_node *np)
|
|
{
|
|
unsigned int irq = irq_of_parse_and_map(np, 0);
|
|
struct clk *clock = of_clk_get(np, 0);
|
|
void __iomem *base = of_iomap(np, 0);
|
|
int ret = 0;
|
|
|
|
if (!base)
|
|
return -ENOMEM;
|
|
if (!irq) {
|
|
ret = -EINVAL;
|
|
goto unmap_io;
|
|
}
|
|
if (IS_ERR(clock)) {
|
|
ret = PTR_ERR(clock);
|
|
goto unmap_io;
|
|
}
|
|
|
|
switch (of_alias_get_id(np, "timer")) {
|
|
case CLPS711X_CLKSRC_CLOCKSOURCE:
|
|
clps711x_clksrc_init(clock, base);
|
|
break;
|
|
case CLPS711X_CLKSRC_CLOCKEVENT:
|
|
ret = _clps711x_clkevt_init(clock, base, irq);
|
|
break;
|
|
default:
|
|
ret = -EINVAL;
|
|
break;
|
|
}
|
|
|
|
unmap_io:
|
|
iounmap(base);
|
|
return ret;
|
|
}
|
|
TIMER_OF_DECLARE(clps711x, "cirrus,ep7209-timer", clps711x_timer_init);
|