public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: lindsey.stanpoor@gmail.com
To: intel-gfx@lists.freedesktop.org, linux-usb@vger.kernel.org
Cc: hdegoede@redhat.com, heikki.krogerus@linux.intel.com,
	gregkh@linuxfoundation.org, cnemo@tutanota.com
Subject: [PATCH 1/1] usb: typec: altmodes/displayport: reorder dp_altmode_configured()
Date: Tue,  5 Oct 2021 21:32:57 -0700	[thread overview]
Message-ID: <20211006043257.23242-1-lindsey.stanpoor@gmail.com> (raw)

From: Cameron Nemo <cnemo@tutanota.com>

A recent commit [1] introduced an unintended behavioral change by
reordering certain function calls. The sysfs_notify call for
pin_assignment should only be invoked when the dp_altmode_notify call
returns 0, and in the dp->data.conf == 0 case.

[1] https://lore.kernel.org/r/20210817215201.795062-8-hdegoede@redhat.com

Signed-off-by: Cameron Nemo <cnemo@tutanota.com>
---
 drivers/usb/typec/altmodes/displayport.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index c1d8c23baa39..a15ae78066e3 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -154,10 +154,17 @@ static int dp_altmode_status_update(struct dp_altmode *dp)
 
 static int dp_altmode_configured(struct dp_altmode *dp)
 {
+	int ret;
+
 	sysfs_notify(&dp->alt->dev.kobj, "displayport", "configuration");
+
+	ret = dp_altmode_notify(dp);
+	if (ret || !dp->data.conf)
+		return ret;
+
 	sysfs_notify(&dp->alt->dev.kobj, "displayport", "pin_assignment");
 
-	return dp_altmode_notify(dp);
+	return 0;
 }
 
 static int dp_altmode_configure_vdm(struct dp_altmode *dp, u32 conf)
-- 
2.33.0


             reply	other threads:[~2021-10-06  4:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06  4:32 lindsey.stanpoor [this message]
2021-10-08  8:09 ` [PATCH 1/1] usb: typec: altmodes/displayport: reorder dp_altmode_configured() Heikki Krogerus
2021-10-08  8:52 ` Hans de Goede

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=20211006043257.23242-1-lindsey.stanpoor@gmail.com \
    --to=lindsey.stanpoor@gmail.com \
    --cc=cnemo@tutanota.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-usb@vger.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