[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <15599140.PsD4j7x3tZ@wuerfel>
Date: Thu, 15 May 2014 10:17:10 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Andrew Bresticker <abrestic@...omium.org>
Cc: linux-tegra@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-usb@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Stephen Warren <swarren@...dotorg.org>,
Thierry Reding <thierry.reding@...il.com>,
Russell King <linux@....linux.org.uk>,
Peter De Schrijver <pdeschrijver@...dia.com>,
Prashant Gaikwad <pgaikwad@...dia.com>,
Mike Turquette <mturquette@...aro.org>,
Kishon Vijay Abraham I <kishon@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mathias Nyman <mathias.nyman@...el.com>,
Grant Likely <grant.likely@...aro.org>,
Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [RFC PATCH 06/10] usb: xhci: Add Tegra XHCI host-controller driver
On Wednesday 14 May 2014 17:33:02 Andrew Bresticker wrote:
> +
> +int tegra_xhci_register_mbox_notifier(struct notifier_block *nb)
> +{
> + int ret;
> +
> + mutex_lock(&tegra_xhci_mbox_lock);
> + ret = raw_notifier_chain_register(&tegra_xhci_mbox_notifiers, nb);
> + mutex_unlock(&tegra_xhci_mbox_lock);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(tegra_xhci_register_mbox_notifier);
> +
> +void tegra_xhci_unregister_mbox_notifier(struct notifier_block *nb)
> +{
> + mutex_lock(&tegra_xhci_mbox_lock);
> + raw_notifier_chain_unregister(&tegra_xhci_mbox_notifiers, nb);
> + mutex_unlock(&tegra_xhci_mbox_lock);
> +}
> +EXPORT_SYMBOL(tegra_xhci_unregister_mbox_notifier);
What driver would use these?
My feeling is that if you have a mailbox that is used by multiple
drivers, you should use a proper mailbox driver to operate them,
and have the drivers register with that API instead of a custom one.
> + /* Create child xhci-plat device */
> + memset(xhci_resources, 0, sizeof(xhci_resources));
> + res = platform_get_resource(to_platform_device(dev), IORESOURCE_IRQ, 0);
> + if (!res) {
> + dev_err(dev, "Missing XHCI IRQ\n");
> + ret = -ENODEV;
> + goto out;
> + }
> + xhci_resources[0].start = res->start;
> + xhci_resources[0].end = res->end;
> + xhci_resources[0].flags = res->flags;
> + xhci_resources[0].name = res->name;
> + res = platform_get_resource(to_platform_device(dev), IORESOURCE_MEM, 0);
> + if (!res) {
> + dev_err(dev, "Missing XHCI registers\n");
> + ret = -ENODEV;
> + goto out;
> + }
> + xhci_resources[1].start = res->start;
> + xhci_resources[1].end = res->end;
> + xhci_resources[1].flags = res->flags;
> + xhci_resources[1].name = res->name;
> +
> + xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO);
> + if (!xhci) {
> + dev_err(dev, "Failed to allocate XHCI host\n");
> + ret = -ENOMEM;
> + goto out;
> + }
This does not feel appropriate at all: Rather than creating a child device,
you should have a specific driver that hooks into functions exported
by the xhci core. See Documentation/driver-model/design-patterns.txt
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists