[PATCH v2 1/7] serial: pxa: add OF support
From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-03-05 12:55:37
Also in:
linux-devicetree
On Monday 05 March 2012, Haojian Zhuang wrote:
quoted hunk
+#define PXA_NAME_LEN 8 + struct uart_pxa_port { struct uart_port port; unsigned char ier;
Why didn't you just add a field here with that length?
quoted hunk
@@ -781,6 +784,39 @@ static const struct dev_pm_ops serial_pxa_pm_ops = { }; #endif +static struct of_device_id serial_pxa_dt_ids[] = { + { .compatible = "mrvl,pxa-uart", }, + { .compatible = "mrvl,mmp-uart", }, + {} +}; +MODULE_DEVICE_TABLE(of, serial_pxa_dt_ids);
This one should have an #ifdef CONFIG_OF
quoted hunk
+#ifdef CONFIG_OF +static int serial_pxa_probe_dt(struct platform_device *pdev, + struct uart_pxa_port *sport) +{
While this one does not need it: it will already compile to nothing if you check the error value correctly.
quoted hunk
+ sport->name = kzalloc(PXA_NAME_LEN, GFP_KERNEL); + if (!sport->name) { + ret = -ENOMEM; + goto err_clk; }
No need for this allocation if you put the name into uart_pxa_port as a member instead of a pointer.
quoted hunk
+ .of_match_table = serial_pxa_dt_ids, }, };
.of_match_table = of_match_ptr(serial_pxa_dt_ids), Arnd