Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74BE0C282CE for ; Wed, 22 May 2019 11:12:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5269B217D9 for ; Wed, 22 May 2019 11:12:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728835AbfEVLMx (ORCPT ); Wed, 22 May 2019 07:12:53 -0400 Received: from mga03.intel.com ([134.134.136.65]:32361 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728743AbfEVLMx (ORCPT ); Wed, 22 May 2019 07:12:53 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2019 04:12:52 -0700 X-ExtLoop1: 1 Received: from kuha.fi.intel.com ([10.237.72.189]) by fmsmga001.fm.intel.com with SMTP; 22 May 2019 04:12:49 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 22 May 2019 14:12:48 +0300 Date: Wed, 22 May 2019 14:12:48 +0300 From: Heikki Krogerus To: Ajay Gupta Cc: Ajay Gupta , "wsa@the-dreams.de" , "linux-usb@vger.kernel.org" , "linux-i2c@vger.kernel.org" Subject: Re: [PATCH v2 3/5] usb: typec: ucsi: ccg: enable runtime pm support Message-ID: <20190522111248.GM1887@kuha.fi.intel.com> References: <20190520183750.2932-1-ajayg@nvidia.com> <20190520183750.2932-4-ajayg@nvidia.com> <20190521133727.GK1887@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Tue, May 21, 2019 at 05:44:50PM +0000, Ajay Gupta wrote: > Hi Heikki > > > > +static int ucsi_ccg_resume(struct device *dev) { > > > + struct i2c_client *client = to_i2c_client(dev); > > > + struct ucsi_ccg *uc = i2c_get_clientdata(client); > > > + struct ucsi *ucsi = uc->ucsi; > > > + struct ucsi_control c; > > > + int ret; > > > + > > > + /* restore UCSI notification enable mask */ > > > + UCSI_CMD_SET_NTFY_ENABLE(c, UCSI_ENABLE_NTFY_ALL); > > > + ret = ucsi_send_command(ucsi, &c, NULL, 0); > > > + if (ret < 0) { > > > + dev_err(uc->dev, "%s: failed to set notification enable - %d\n", > > > + __func__, ret); > > > + } > > > + return 0; > > > +} > > > > I would prefer that we did this for all methods in ucsi.c, not just ccgx. Could you > > add resume callback to struct ucsi_ppm, and then call it here. > struct ucsi_ppm currently have .sync() and .cmd() callback which is implemented by > ucsi_ccg and ucsi_acpi and invoked by usci.c. > > Is it okay to add a callback in this structure and implement inside ucsi.c and invoke > from ucsi_ccg and ucsi_acpi? OR we can just add a function in ucsi.c and export it > and use it from ucsi_ccg and ucsi_acpi? Right! Export the function. Sorry. thanks, -- heikki