Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5603509rwb; Tue, 22 Nov 2022 02:15:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf4JwKAM2XRb+8GhB4OSbR6q3yLQo5PyR7svmpTvg5JLKKWnNuXx6GnfuN3Tbk3NsT+f0u0m X-Received: by 2002:a63:f91a:0:b0:477:8109:ccea with SMTP id h26-20020a63f91a000000b004778109cceamr6301380pgi.376.1669112158200; Tue, 22 Nov 2022 02:15:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112158; cv=none; d=google.com; s=arc-20160816; b=v7PR1eEpXlrqLwT5KwPXC5L1Qc6zDlFWvbR+E11zW9Hi4paE2v1mOwt99TAL6FIHKK QZZyqTspTAW7Rxcq81ws8syJXrm1ZfDk4S/c7tuCVfuPR1NuPhuMdKHE9g8pYj6MJuc/ 5C2B9LdbaylOUgcJq/4xe8deeKnq34pX+O1g3xsYWvJA1o2+SAW3H9YJWWJWSFE8p5iR maqlGmCkhqI5AaZ36O9OxEALpUinlVF0YLPvk+wLztoaK49Clhnf67kVQllZdOL37V6J WV9Fb/AN2sq9/PegqIW+s+rGZaqKtJe2zA0cClSG/OTMfHBAgkzxdo2UhHMHPtfOeEiG 0adg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rjVM9HsVR1Wizr/8fsfe3nMEDWXrhbMZnJrOX/oYmoc=; b=FcP9TXP3whDW2yuEFU8WgQ8VcyIKfd5M1YkPGFU28+z6FuTq3iewAJK88PQ7+9dnV0 rSuuDO6D556xreve1hThMS8tCK8N3stjrwudZ6cAnWxQpOVjmNdTt9Z5EmEgnXY0H/Lf J7cSRIDOL9v9V/+AwW3x46C8U+ckRvh/TPsKz99Pyo9Nu4xfnvvTaT0fUTD1r4h9bYCn s0JJQmJQincNkWNvpfTMUIr7G6x6uouWN/1f5nkMha3gT+5mYIspALg5rJncBIFgBZRZ UBvuipPtKutUC/qIasqxnJ4WqUpFgFAUcbTippkCYsPDKfMbmXvWq52VlQDyXxw1RGVe zpwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j7vpYC73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a63570a000000b0046afa55b6a5si13583282pgb.708.2022.11.22.02.15.45; Tue, 22 Nov 2022 02:15:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j7vpYC73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbiKVJ6q (ORCPT + 91 others); Tue, 22 Nov 2022 04:58:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233434AbiKVJ6j (ORCPT ); Tue, 22 Nov 2022 04:58:39 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943801CB0C; Tue, 22 Nov 2022 01:58:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669111106; x=1700647106; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Ub2ULHl6Lnt9vs3IfOcNn6hW23qKp2CpnI2lQIsoK2c=; b=j7vpYC73i410jNReDdzDOefATfZdJ2cfq9CioKyew0mkjcs3/Szvn7L/ yZzpbeU30lI9bju0mEkOx2IRfXAU3BVajmDcaoEVSVF9fCT+/JYzFswcx jpq8NNEGRnsnMiYROeQ1hsgH8Iw6suF76AUU441AGIl329Q3wv2JCAKOp 8vWr8A6V4OusA2Hkd7HPPCbEw2jFuOUJR+1a7x0lFrAXjdC5BcZe1LogR dKMOW5OHFKb2iG+Cd8cUZeB8h3x9mtULRoWRjsb7wvDrbGvUYpQZ0lRdU y3wUT9R6yFoT+eCloVJZFfqflrsciVbhTs/prAMD1/oaIA62JkaNCeyt5 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="311408086" X-IronPort-AV: E=Sophos;i="5.96,183,1665471600"; d="scan'208";a="311408086" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2022 01:58:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="783788444" X-IronPort-AV: E=Sophos;i="5.96,183,1665471600"; d="scan'208";a="783788444" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 22 Nov 2022 01:58:22 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 22 Nov 2022 11:58:22 +0200 Date: Tue, 22 Nov 2022 11:58:22 +0200 From: Heikki Krogerus To: Prashant Malani Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev, Benson Leung , Greg Kroah-Hartman , Guenter Roeck Subject: Re: [PATCH 1/2] usb: typec: Add helper to get partner device struct Message-ID: References: <20221121201337.2772216-1-pmalani@chromium.org> <20221121201337.2772216-2-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221121201337.2772216-2-pmalani@chromium.org> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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