Thread (1 message) 1 message, 1 author, 2014-10-29

[PATCH 1/2] ARM: socfpga: Add driver for the L3 interconnect

From: Uwe Kleine-König <hidden>
Date: 2014-10-29 21:12:28
Also in: linux-devicetree

Hello Steffen,

On Wed, Oct 29, 2014 at 09:51:03PM +0100, Steffen Trumtrar wrote:
quoted
quoted
+
+int socfpga_l3nic_regmap_by_phandle(struct device_node *np,
+				    struct regmap **regmap,
+				    const char *name)
+{
This could return the regmap or ERR_PTR(-ENODEV) and just
have the np and name parameter, similar to 
syscon_regmap_lookup_by_phandle.
I wanted to do that, but I also want to propagate the return
value of socfpga_gpv_device_by_phandle and this doesn't
seem to work than. Open for suggestions, though.
Doesn't the following work:

	struct regmap *socfpga_l3nic_regmap_by_phandle(struct device_node *np,
						       const char *name)
	{
		struct socfpga_l3nic *l3nic;
		struct platform_device *pdev;

		pdev = socfpga_gpv_device_by_phandle(np, name);
		if (!pdev)
			/* it's wrong to apply ERR_PTR to NULL */
			return ERR_PTR(-ENODEV);

		l3nic = dev_get_drvdata(&pdev->dev);
		if (!l3nic)
			return ERR_PTR(-EINVAL);

		/* do you need to check l3nic->regmap for being != NULL? */
		return l3nic->regmap;
	}

?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help