From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6578C77B73 for ; Thu, 13 Apr 2023 07:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbjDMHL2 convert rfc822-to-8bit (ORCPT ); Thu, 13 Apr 2023 03:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjDMHL1 (ORCPT ); Thu, 13 Apr 2023 03:11:27 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6A80C1BD; Thu, 13 Apr 2023 00:11:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id B08DB80F0; Thu, 13 Apr 2023 07:11:25 +0000 (UTC) Date: Thu, 13 Apr 2023 10:11:24 +0300 From: Tony Lindgren To: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= Cc: Vignesh R , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Janusz Krzysztofik , Wolfram Sang , Andreas Kemnade , linux-i2c@vger.kernel.org, kernel@pengutronix.de, Aaro Koskinen , linux-omap@vger.kernel.org Subject: Re: [PATCH] i2c: omap: Improve error reporting for problems during .remove() Message-ID: <20230413071124.GB36234@atomide.com> References: <20230402105518.2512541-1-u.kleine-koenig@pengutronix.de> <20230402225001.75a32147@aktux> <20230403054837.6lxyzznzntvw2drg@pengutronix.de> <20230403060404.GX7501@atomide.com> <20230406082354.jwchbl5ir6p4gjw7@pengutronix.de> <20230413051222.GA9837@atomide.com> <20230413062440.yixne5wqed4zrva4@pengutronix.de> <20230413063915.GA36234@atomide.com> <20230413070745.mpcqpqokqspzavca@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20230413070745.mpcqpqokqspzavca@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org * Uwe Kleine-König [230413 07:07]: > On Thu, Apr 13, 2023 at 09:39:15AM +0300, Tony Lindgren wrote: > > Oh OK. Care to clarify a bit why we are not allowed to return errors > > on remove though? Are we getting rid of the return value for remove? > > Sorry if I'm not following the cunning plan here :) > > Yes, that's the plan. If you look at the caller of the remove functions > (before 5c5a7680e67ba6fbbb5f4d79fa41485450c1985c): > > static void platform_remove(struct device *_dev) > { > struct platform_driver *drv = to_platform_driver(_dev->driver); > struct platform_device *dev = to_platform_device(_dev); > > if (drv->remove) { > int ret = drv->remove(dev); > > if (ret) > dev_warn(_dev, "remove callback returned a non-zero value. This will be ignored.\n"); > } > dev_pm_domain_detach(_dev, true); > } > > you see it's pointless to return an error value. But the prototype > seduces driver authors to do it yielding to error that can easily > prevented if .remove returns void. See also > 5c5a7680e67ba6fbbb5f4d79fa41485450c1985c for some background and details > of the quest. OK thanks. So maybe check the pm_runtime_get_sync() and on error do pm_runtime_put_noidle(), or pm_runtime_resume_and_get(). Both ways are fine for me, maybe you already figured it out. Regards, Tony