Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp271257ybe; Mon, 2 Sep 2019 01:03:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgEGZ/yYSgD9kr4KATHfdrq737jjLcYXw0f1+pbh+32/vpvutMavATeCPBz6je2BRoUF6d X-Received: by 2002:a62:34c4:: with SMTP id b187mr33560474pfa.161.1567411419465; Mon, 02 Sep 2019 01:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567411419; cv=none; d=google.com; s=arc-20160816; b=i+sMm6QcSTiVRQEdfuc2up1nnz+1EFNE4JHcHRm9kO5pSDAilhV1FX5KnQ+azp/Fnj wcVkrxy0C804LMMP3vHrnmQEIdBT9w8DxdYHw5ebXdVLZP/ELzoysUfKzoN2WU4S8kgR /rTLLm25w8NhBJUkFO5LSljTtBQMtbKUzXHuPjQseE8bBvTZPRYqAY1zC5ZPOM1duLTu RzERAyZMa95oQN+LiQdtcTmNYtDY3Hkr3lFCacqQZ0Cg+9TbdgqE+yBTxsSTQJVQ6kAS LJjk+rC1sl8WSzDtKAfdb8BCw6aCMK8OyV8lwMyPu14lDWNIBmDTFfY7FuqBzmDq5edh MSWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZByN7Q/UJkhv93CbJb+DMqSo6w3IWsXsW4o/9woemBE=; b=DNN5VO0dSM3CGjPezIUTcfujuu+lKxLTKqJEDTKcfd26FPyxYiyvQWUk63dUZkjc6p ouB9ouv9vAZKxU2IBNY5umMt6uvU/Wgq1hkxLSM/8xKSlKAaQQsixoS2lTjdQvplljDJ o2KzBgsESPP34Wz0EQIh/hoZDyoVGFie8oT4zxYXEQIjp6dNUTY6qGx43Fa/ulbsGkju be3AQndTbGHC0UnY79ExFEJ5mLYTevppWx4nOLRGVqSFKmpdCj4XMKz2MGPzgJ6pc3ww RCd5bP1VM7wmNrZuEmzX81Wn118QgstBukSSvDk4uWSHMBuaS5yvOvMWpS+LA3ISIapT B5QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="npha/fxK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si151300pjv.4.2019.09.02.01.03.24; Mon, 02 Sep 2019 01:03:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="npha/fxK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730013AbfIBIAq (ORCPT + 99 others); Mon, 2 Sep 2019 04:00:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:55374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729535AbfIBIAq (ORCPT ); Mon, 2 Sep 2019 04:00:46 -0400 Received: from earth.universe (dyndsl-091-096-044-124.ewe-ip-backbone.de [91.96.44.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 10DA122CF7; Mon, 2 Sep 2019 08:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567411245; bh=L83zCSB1qiwTYwMO95Zsb92WohQS4er/qeMOyrCaEvc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=npha/fxKlCxSrpKAu0q7t6vulPXDDZwH1O7a/jwXEwqLgNwoQUD+DyNsFTsCY8NJj DL2Ek58sfD2J6glEz8zMNVmSC3sjqLzn6y2gajXHNtH4IB1ngez5w3DiAiL+fheqQZ 32EuL94JEk+H7L9mArHt/EQxmqgd/sWEeRXlyep4= Received: by earth.universe (Postfix, from userid 1000) id 4216C3C0B7F; Mon, 2 Sep 2019 10:00:43 +0200 (CEST) Date: Mon, 2 Sep 2019 10:00:43 +0200 From: Sebastian Reichel To: Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, kernel-team@android.com, Greg Kroah-Hartman , Tri Vo , Kalesh Singh , Ravi Chandra Sadineni , "Rafael J. Wysocki" , Viresh Kumar Subject: Re: [PATCH] power: supply: Init device wakeup after device_add() Message-ID: <20190902080043.nx7rqf32fv7w6eoy@earth.universe> References: <20190801213330.81079-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fcu4abygg3rqtqkb" Content-Disposition: inline In-Reply-To: <20190801213330.81079-1-swboyd@chromium.org> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --fcu4abygg3rqtqkb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Thu, Aug 01, 2019 at 02:33:30PM -0700, Stephen Boyd wrote: > We may want to use the device pointer in device_init_wakeup() with > functions that expect the device to already be added with device_add(). > For example, if we were to link the device initializing wakeup to > something in sysfs such as a class for wakeups we'll run into an error. > It looks like this code was written with the assumption that the device > would be added before initializing wakeup due to the order of operations > in power_supply_unregister(). >=20 > Let's change the order of operations so we don't run into problems here. >=20 > Fixes: 948dcf966228 ("power_supply: Prevent suspend until power supply ev= ents are processed") > Cc: Greg Kroah-Hartman = = =20 > Cc: Tri Vo = = =20 > Cc: Kalesh Singh =20 > Cc: Ravi Chandra Sadineni > Cc: "Rafael J. Wysocki" > Cc: Viresh Kumar > Signed-off-by: Stephen Boyd > --- Thanks, queued. -- Sebastian >=20 > See this thread[1] for more information on how this will be necessary. >=20 > [1] https://lkml.kernel.org/r/20190731215514.212215-1-trong@android.com >=20 >=20 > drivers/power/supply/power_supply_core.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/sup= ply/power_supply_core.c > index 82e84801264c..5c36c430ce8b 100644 > --- a/drivers/power/supply/power_supply_core.c > +++ b/drivers/power/supply/power_supply_core.c > @@ -1051,14 +1051,14 @@ __power_supply_register(struct device *parent, > } > =20 > spin_lock_init(&psy->changed_lock); > - rc =3D device_init_wakeup(dev, ws); > - if (rc) > - goto wakeup_init_failed; > - > rc =3D device_add(dev); > if (rc) > goto device_add_failed; > =20 > + rc =3D device_init_wakeup(dev, ws); > + if (rc) > + goto wakeup_init_failed; > + > rc =3D psy_register_thermal(psy); > if (rc) > goto register_thermal_failed; > @@ -1101,8 +1101,8 @@ __power_supply_register(struct device *parent, > psy_unregister_thermal(psy); > register_thermal_failed: > device_del(dev); > -device_add_failed: > wakeup_init_failed: > +device_add_failed: > check_supplies_failed: > dev_set_name_failed: > put_device(dev); > --=20 > Sent by a computer through tubes >=20 --fcu4abygg3rqtqkb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAl1szCsACgkQ2O7X88g7 +poKTg/+PPMWnxzv7N42HIkbJcOljQK+Bkv98IuSroLz7Sg3wsA07untO69B+e+A xZLwbmJo7hPCpBFyCIlN+LRSrvFPwpdbUKJiSpfkuUWMe/9hUhBSupZWftJbrz8H 5BSBBxeXdNwULTZ/8Dg2j3I/0udexWUFxpUVSPTjzJrGXgNqY0P49957G6E5N4VE ul7HdgnkAqzo/cfrLn03WOOZbEstgni41hpj6cvtgC2CiZwDjaZK6+oNboIBYHZl HlvJMezAV2YaAnPwteNm2B4wDlQ83AjcUpPH0EkmuqlQr2Iq9zEuXO9/NjZeMKUK S7YHGj170r2IQRUjG1J1hGAbrWF5Xc1KgQMvdXM95eQP9aGrYzP/AzoRrOUpD1A4 OOyG6PPHIfQ72jM5UiTDrWPhygLasvWPW6lPTu3xFQbwZ4lPUg63d0F6QicvBjl+ a43tZJUeIjs/7mR8KM7A88FqOTu+NcR6JbDeJvnPiogBF3V+rrJ2AJL+hdHwSBn1 xcMYoxz4p9Su/vdSV4baOpx0zEFDThXl7iIKiqH8xpIe8vqlYQRg8XsD4dRJYHZ4 49QwK0l7ykeoM/jB7V9tj3pZ/OC2KA6NxBI76z3kgsuPSe5CqNexQfeKU6zT+VCe 3o46oe3ZBCI9/Ehipnk28FE1y6KuZf+z9akmtbyWiVCA0ntdUWY= =XWqr -----END PGP SIGNATURE----- --fcu4abygg3rqtqkb--