From: Arnd Bergmann <arnd@arndb.de>
To: Al Cooper <alcooperx@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Alban Bedel <albeu@free.fr>, Alex Elder <elder@linaro.org>,
Andrew Morton <akpm@linux-foundation.org>,
Avi Fishman <avifishman70@gmail.com>,
bcm-kernel-feedback-list@broadcom.com,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
David Miller <davem@davemloft.net>,
DTML <devicetree@vger.kernel.org>,
Dmitry Osipenko <digetx@gmail.com>,
gregkh <gregkh@linuxfoundation.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Hans de Goede <hdegoede@redhat.com>,
James Hogan <jhogan@kernel.org>,
sunjianguo1@huawei.com, Johan Hovold <johan@kernel.org>,
Kees Cook <keescook@chromium.org>,
USB list <linux-usb@vger.kernel.org>,
Lu Baolu <baolu.lu@linux.intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
rishabhb@codeaurora.org, Rob Herring <robh+dt@kernel.org>,
Roger Quadros <rogerq@ti.com>
Subject: Re: [PATCH V2 4/6] usb: ohci-platform: Add support for Broadcom STB SoC's
Date: Wed, 24 Oct 2018 08:11:09 +0100 [thread overview]
Message-ID: <CAK8P3a3Qw6YraHveY4MW=3u-q5YyOzM3X8V9Q=X7Wr4=1gApGg@mail.gmail.com> (raw)
In-Reply-To: <1539815349-24126-5-git-send-email-alcooperx@gmail.com>
On Wed, Oct 17, 2018 at 11:30 PM Al Cooper <alcooperx@gmail.com> wrote:
>
> Add support for Broadcom STB SoC's to the ohci platform driver.
>
> Signed-off-by: Al Cooper <alcooperx@gmail.com>
> ---
> drivers/usb/host/ohci-platform.c | 35 +++++++++++++++++++++++++++++------
> include/linux/usb/ohci_pdriver.h | 1 +
> 2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> index 65a1c3fdc88c..363d6fa676a5 100644
> --- a/drivers/usb/host/ohci-platform.c
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -22,6 +22,7 @@
> #include <linux/module.h>
> #include <linux/err.h>
> #include <linux/of.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> #include <linux/reset.h>
> @@ -99,12 +100,24 @@ static int ohci_platform_probe(struct platform_device *dev)
> if (usb_disabled())
> return -ENODEV;
>
> - /*
> - * Use reasonable defaults so platforms don't have to provide these
> - * with DT probing on ARM.
> - */
> - if (!pdata)
> - pdata = &ohci_platform_defaults;
> + if (!pdata) {
> + const struct usb_ohci_pdata *match_pdata;
> +
> + match_pdata = of_device_get_match_data(&dev->dev);
> + if (match_pdata) {
> + pdata = devm_kzalloc(&dev->dev, sizeof(*pdata),
> + GFP_KERNEL);
> + if (!pdata)
> + return -ENOMEM;
> + *pdata = *match_pdata;
It looks like you copy the const pdata to get a non-const version.
Have you tried
propagating the 'const' modifier so that users can rely on that here?
> + } else {
> + /*
> + * Use reasonable defaults so platforms don't have
> + * to provide these with DT probing on ARM.
> + */
> + pdata = &ohci_platform_defaults;
> + }
> + }
That would also allow you to unify it with the else path by listing
the ohci_platform_defaults
in the id table for all other compatible strings.
Arnd
next prev parent reply other threads:[~2018-10-24 7:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-17 22:29 [PATCH V2 0/6] Add XHCI, EHCI and OHCI support for Broadcom STB SoS's Al Cooper
2018-10-17 22:29 ` [PATCH V2 1/6] dt-bindings: Add Broadcom STB OHCI, EHCI and XHCI binding document Al Cooper
2018-10-18 20:38 ` Rob Herring
2018-10-17 22:29 ` [PATCH V2 2/6] usb: core: Add ability to skip phy exit on suspend and init on resume Al Cooper
2018-10-18 1:46 ` Chunfeng Yun
2018-10-17 22:29 ` [PATCH V2 3/6] usb: xhci: xhci-plat: Add support for Broadcom STB SoC's Al Cooper
2018-10-18 16:49 ` kbuild test robot
2018-10-19 4:53 ` kbuild test robot
2018-10-17 22:29 ` [PATCH V2 4/6] usb: ohci-platform: " Al Cooper
2018-10-24 7:11 ` Arnd Bergmann [this message]
2018-10-17 22:29 ` [PATCH V2 5/6] usb: ehci: Add new EHCI driver " Al Cooper
2018-10-24 7:14 ` Arnd Bergmann
2018-10-17 22:29 ` [PATCH V2 6/6] usb: host: Add ability to build new Broadcom STB USB drivers Al Cooper
2018-10-18 14:35 ` Alan Stern
[not found] <CAOGqxeVfZaJWCVvjNq6_N_eQBvW-8z7NaOmRcQb6hE_c416v6A@mail.gmail.com>
2018-10-30 20:08 ` [PATCH V2 4/6] usb: ohci-platform: Add support for Broadcom STB SoC's Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK8P3a3Qw6YraHveY4MW=3u-q5YyOzM3X8V9Q=X7Wr4=1gApGg@mail.gmail.com' \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=albeu@free.fr \
--cc=alcooperx@gmail.com \
--cc=avifishman70@gmail.com \
--cc=baolu.lu@linux.intel.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bjorn.andersson@linaro.org \
--cc=chunfeng.yun@mediatek.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=digetx@gmail.com \
--cc=elder@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=hdegoede@redhat.com \
--cc=jhogan@kernel.org \
--cc=johan@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mathias.nyman@intel.com \
--cc=mathias.nyman@linux.intel.com \
--cc=mchehab+samsung@kernel.org \
--cc=rishabhb@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=rogerq@ti.com \
--cc=stern@rowland.harvard.edu \
--cc=sunjianguo1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).