From: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: Heikki Krogerus
<heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Mathias Nyman
<mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: devicetree: avoid duplicated matching code (was: Re: [PATCH 1/3] xhci: plat: adapt to unified device property interface)
Date: Thu, 21 Apr 2016 14:20:46 +0300 [thread overview]
Message-ID: <87fuuf9pip.fsf@intel.com> (raw)
In-Reply-To: <1461064246-27350-2-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]
Hi,
Heikki Krogerus <heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> writes:
> @@ -197,7 +196,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
> }
>
> xhci = hcd_to_xhci(hcd);
> - match = of_match_node(usb_xhci_of_match, node);
> + match = of_match_node(usb_xhci_of_match, pdev->dev.of_node);
Rob, it's weird that OF-based drivers have to redo the same matching
which was already done by drivers/base/platform.c::platform_match() just
to get match->data. If we know we matched, couldn't we just cache a
pointer to match->data in struct device_node.data ? Something like
below? (completely untested)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index b299de2b3afa..9b44caa38f7c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -981,6 +981,8 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches,
raw_spin_lock_irqsave(&devtree_lock, flags);
match = __of_match_node(matches, node);
+ if (match)
+ node->data = match->data;
raw_spin_unlock_irqrestore(&devtree_lock, flags);
return match;
}
I tried to find users of device_node.data but couldn't find any. If this
patch is acceptable, we can remove 160 occurences of of_match_node with
some variance of node->data.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next parent reply other threads:[~2016-04-21 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1461064246-27350-1-git-send-email-heikki.krogerus@linux.intel.com>
[not found] ` <1461064246-27350-2-git-send-email-heikki.krogerus@linux.intel.com>
[not found] ` <1461064246-27350-2-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-21 11:20 ` Felipe Balbi [this message]
[not found] ` <87fuuf9pip.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-21 13:00 ` devicetree: avoid duplicated matching code (was: Re: [PATCH 1/3] xhci: plat: adapt to unified device property interface) Rob Herring
[not found] ` <CAL_JsqLVAN_dEcGUbNyiBjFJTSPSPjMKzWG9QBoJ71whpfmBiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-21 13:57 ` Felipe Balbi
[not found] ` <874mav9i9z.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-22 13:25 ` Rob Herring
[not found] ` <CAL_JsqLh76fPT0CWo6r=5TGJebXO5sLZ-BOtGZ=-fd1+n5S5eA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-25 6:38 ` Felipe Balbi
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=87fuuf9pip.fsf@intel.com \
--to=felipe.balbi-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/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).