devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Jun <jun.li@nxp.com>
To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, rafael@kernel.org
Cc: gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com,
	hdegoede@redhat.com, lee.jones@linaro.org,
	mika.westerberg@linux.intel.com, dmitry.torokhov@gmail.com,
	prabhakar.mahadev-lad.rj@bp.renesas.com,
	laurent.pinchart+renesas@ideasonboard.com,
	linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-imx@nxp.com, peter.chen@nxp.com
Subject: [PATCH v6 4/6] usb: typec: mux: use fwnode's dev for driver module user count
Date: Mon, 23 Nov 2020 22:01:34 +0800	[thread overview]
Message-ID: <1606140096-1382-4-git-send-email-jun.li@nxp.com> (raw)
In-Reply-To: <1606140096-1382-1-git-send-email-jun.li@nxp.com>

As the typec switch provider driver's dev may not the parent of
typec_switch dev(may be the switch's parent's parent), but we use
the typec switch provider driver dev's fwnode anyway, so change to
use fwnode's dev to get driver's user count.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
New patch for v6.

 drivers/usb/typec/mux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index 3da17d1..0219aa4 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -65,7 +65,7 @@ struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode)
 	sw = fwnode_connection_find_match(fwnode, "typec-orientation-switch",
 					  NULL, typec_switch_match);
 	if (!IS_ERR_OR_NULL(sw))
-		WARN_ON(!try_module_get(sw->dev.parent->driver->owner));
+		WARN_ON(!try_module_get(dev_fwnode(&sw->dev)->dev->driver->owner));
 
 	return sw;
 }
@@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(fwnode_typec_switch_get);
 void typec_switch_put(struct typec_switch *sw)
 {
 	if (!IS_ERR_OR_NULL(sw)) {
-		module_put(sw->dev.parent->driver->owner);
+		module_put(dev_fwnode(&sw->dev)->dev->driver->owner);
 		put_device(&sw->dev);
 	}
 }
-- 
2.7.4


  parent reply	other threads:[~2020-11-23 14:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 14:01 [PATCH v6 1/6] dt-bindings: usb: add documentation for typec switch simple driver Li Jun
2020-11-23 14:01 ` [PATCH v6 2/6] device property: Add fwnode_is_compatible() and device_is_compatible() helpers Li Jun
2020-11-23 14:01 ` [PATCH v6 3/6] usb: typec: mux: add "compatible" property for switch match Li Jun
2020-11-23 14:01 ` Li Jun [this message]
2020-11-26 11:58   ` [PATCH v6 4/6] usb: typec: mux: use fwnode's dev for driver module user count Heikki Krogerus
2020-11-23 14:01 ` [PATCH v6 5/6] usb: typec: mux: add typec switch via general mux control Li Jun
2020-11-23 15:31   ` Andy Shevchenko
2020-11-24  2:15     ` Jun Li
2020-11-23 14:01 ` [PATCH v6 6/6] usb: typec: mux: add typec switch simple driver Li Jun
2020-11-26 11:59   ` Heikki Krogerus
2020-11-30 21:47 ` [PATCH v6 1/6] dt-bindings: usb: add documentation for " Rob Herring
2020-12-01  3:13   ` Jun Li
2020-12-03 12:24     ` Jun Li

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=1606140096-1382-4-git-send-email-jun.li@nxp.com \
    --to=jun.li@nxp.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=peter.chen@nxp.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.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).