Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7e8d149 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

Merge tag 'timers-v5.4-rc6' of...

Merge tag 'timers-v5.4-rc6' of https://git.linaro.org/people/daniel.lezcano/linux into timers/urgent

Pull clockevent fixes from Daniel Lezcano:

 - Fix scary messages in sh_mtu2 by using platform_irq_count() helper
   function (Geert Uytterhoeven)

 - Fix double free when using timer-of in the mediatek timer driver
   (Fabien Parent)
parents a99d8080 7693de9f
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -328,12 +328,13 @@ static int sh_mtu2_register(struct sh_mtu2_channel *ch, const char *name)
	return 0;
}

static const unsigned int sh_mtu2_channel_offsets[] = {
	0x300, 0x380, 0x000,
};

static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,
				 struct sh_mtu2_device *mtu)
{
	static const unsigned int channel_offsets[] = {
		0x300, 0x380, 0x000,
	};
	char name[6];
	int irq;
	int ret;
@@ -356,7 +357,7 @@ static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,
		return ret;
	}

	ch->base = mtu->mapbase + channel_offsets[index];
	ch->base = mtu->mapbase + sh_mtu2_channel_offsets[index];
	ch->index = index;

	return sh_mtu2_register(ch, dev_name(&mtu->pdev->dev));
@@ -408,7 +409,12 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
	}

	/* Allocate and setup the channels. */
	mtu->num_channels = 3;
	ret = platform_irq_count(pdev);
	if (ret < 0)
		goto err_unmap;

	mtu->num_channels = min_t(unsigned int, ret,
				  ARRAY_SIZE(sh_mtu2_channel_offsets));

	mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels),
				GFP_KERNEL);
+2 −8
Original line number Diff line number Diff line
@@ -268,15 +268,12 @@ static int __init mtk_syst_init(struct device_node *node)

	ret = timer_of_init(node, &to);
	if (ret)
		goto err;
		return ret;

	clockevents_config_and_register(&to.clkevt, timer_of_rate(&to),
					TIMER_SYNC_TICKS, 0xffffffff);

	return 0;
err:
	timer_of_cleanup(&to);
	return ret;
}

static int __init mtk_gpt_init(struct device_node *node)
@@ -293,7 +290,7 @@ static int __init mtk_gpt_init(struct device_node *node)

	ret = timer_of_init(node, &to);
	if (ret)
		goto err;
		return ret;

	/* Configure clock source */
	mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN);
@@ -311,9 +308,6 @@ static int __init mtk_gpt_init(struct device_node *node)
	mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);

	return 0;
err:
	timer_of_cleanup(&to);
	return ret;
}
TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);