Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9595524rwd; Wed, 21 Jun 2023 09:16:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4eLG8RTdY/t8MpcHDnig3dmSHvJSVjBLakwEABlo0K9/1suFHnFE4JHW615N+UYK12ZKT7 X-Received: by 2002:a05:6808:1149:b0:3a0:3eca:b8b7 with SMTP id u9-20020a056808114900b003a03ecab8b7mr5957868oiu.47.1687364180863; Wed, 21 Jun 2023 09:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687364180; cv=none; d=google.com; s=arc-20160816; b=b/PRpFA61/vUnX0rwMRXUvyr62J7kF9RrNKEY9qFncCAE0BP/N5zRywvC4QwoDGJ56 a6GZ3pvtNAIELktighmmlHF4wUP+na5pRl9+BIkMzaIi4x1cBOIHSx02vVSjbC1APYct cVlTlAUh31DAH/TeC6HrjC/oS5qcJFUVEw9Nxx9YbMZeoU/BCoKAcUS+4hDdmNLxQpSO IRLrX6yGwVuV3jkffD0qpZsnKEt/68q+lup4eGdIRE9Uws4xRlWBsJejzOvUVe0Jtv14 PcgbbNe6L82rNW3RJQsr0rRJP+aSot0euRBxVgGJaWVDvU5yyBykPyqCPewoycEFr42n lUYg== 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=M8pQtfRofWxe34IPhD2QDvmIi69CKfXNM/Uvp9YIqyE=; b=qy6CROSk8MeOWidpWFX0zLSuiPUxSQmE/d8NTshacn+HBmaD4eTFhL10gCe6pDkRoH 0om/Nngc9wn1L6AK6vxuwR4j2NbEadMnGLeuK9wkw7oh5+A04eR3XSZ7MtWV0bn4dGfg Ll52dDLbTwBGft/PBmLNyR8FGhiQHp8hQFd7YarNHGGoJi4QRXHezd7IKQB1ZJhLzCp+ PKv5YanEVPjw0rUgioAMmGvqOx6ySqL8S2IcYzhynqLJEDrH/N0WzJPZ8QW3XRqve06g vboYF/to85v0jbXggBtVHpGQ/FvJa7QNgU4mF/OFUJ2DvLelrtgBhGt31C5u89beIziH 0xFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C4NsEBbM; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p25-20020a637f59000000b005429248576asi984504pgn.128.2023.06.21.09.16.08; Wed, 21 Jun 2023 09:16:20 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=C4NsEBbM; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233348AbjFUPYF (ORCPT + 99 others); Wed, 21 Jun 2023 11:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233336AbjFUPXr (ORCPT ); Wed, 21 Jun 2023 11:23:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 735F5213B; Wed, 21 Jun 2023 08:22:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EFAAD61597; Wed, 21 Jun 2023 15:22:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD551C433C8; Wed, 21 Jun 2023 15:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687360977; bh=1myIkCNrGS9LjMUd1rt6ohpLBP7wjHK5DM7AyaPDCLI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C4NsEBbMaKKW3pbO+gVpbt0BLhgzmRAxMt40/S067cELpNYvZT9LPPpKoMLnPPNGg BmfNuqQDwhKNTrIuwc9IMuxSqIHr+CjbQ7vbNvPEDeS1vdBRg9TdxxDBdEarkQXoR6 nFaW7MKeep+SvsTBiaGu/VxKWlD6DXfvHJN7XiUk= Date: Wed, 21 Jun 2023 17:22:54 +0200 From: Greg Kroah-Hartman To: Abel Vesa Cc: "Rafael J . Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Saravana Kannan , Bjorn Andersson , linux-pm@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, Dmitry Baryshkov Subject: Re: [RFC PATCH v5 2/4] driver core: Add dev_is_drv_state_synced() Message-ID: <2023062103-chevron-sabotage-bf26@gregkh> References: <20230621144019.3219858-1-abel.vesa@linaro.org> <20230621144019.3219858-3-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230621144019.3219858-3-abel.vesa@linaro.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Wed, Jun 21, 2023 at 05:40:17PM +0300, Abel Vesa wrote: > This can be used by drivers to figure out if a different device > driver has state synced or not for a specific device. > > Signed-off-by: Abel Vesa > --- > include/linux/device.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/include/linux/device.h b/include/linux/device.h > index bae11928ef7e..8f042f04b5d9 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -1007,6 +1007,20 @@ static inline int dev_set_drv_sync_state(struct device *dev, > return 0; > } > > +static inline bool dev_is_drv_state_synced(struct device *dev) > +{ > + bool ret = false; > + > + if (!dev) > + return ret; > + > + device_lock(dev); > + ret = dev->state_synced; > + device_unlock(dev); This lock is "protecting" nothing, given that the value can instantly change after it is read. Because it can change, how will this function actually show anything relevant? thanks, greg k-h