public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	chrome-platform@lists.linux.dev,
	Benson Leung <bleung@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH 1/2] usb: typec: Add helper to get partner device struct
Date: Tue, 22 Nov 2022 11:58:22 +0200	[thread overview]
Message-ID: <Y3ydPqkxxQCSGGp7@kuha.fi.intel.com> (raw)
In-Reply-To: <20221121201337.2772216-2-pmalani@chromium.org>

Hi Prashant,

On Mon, Nov 21, 2022 at 08:13:35PM +0000, Prashant Malani wrote:
> +/**
> + * typec_partner_to_dev - Get the device struct of a USB Type-C partner.
> + * @partner: USB Type-C Partner
> + *
> + * Returns a pointer to the device struct or NULL.
> + */
> +struct device *typec_partner_to_dev(struct typec_partner *partner)
> +{
> +	return partner ? &partner->dev : NULL;
> +}
> +EXPORT_SYMBOL_GPL(typec_partner_to_dev);

Let's not loose the protection around these devices unless there is no
other way, and in this case there is.

Please just create a wrapper for usb_power_delivery_register() instead:

struct usb_power_delivery *
typec_partner_usb_power_delivery_register(struct typec_partner *partner,
                                          struct usb_power_delivery_desc *desc)
{
        return usb_power_delivery_register(&partner->dev, desc);
}
EXPORT_SYMBOL_GPL(typec_partner_usb_power_delivery_register);

thanks,

-- 
heikki

  reply	other threads:[~2022-11-22  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 20:13 [PATCH 0/2] platform/chrome: cros_ec_typec: Link PD object to partner Prashant Malani
2022-11-21 20:13 ` [PATCH 1/2] usb: typec: Add helper to get partner device struct Prashant Malani
2022-11-22  9:58   ` Heikki Krogerus [this message]
2022-11-22 19:05     ` Prashant Malani
2022-11-23  8:49       ` Heikki Krogerus
2022-11-21 20:13 ` [PATCH 2/2] platform/chrome: cros_ec_typec: Set parent of partner PD object Prashant Malani

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=Y3ydPqkxxQCSGGp7@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pmalani@chromium.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