Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9464768rwd; Wed, 21 Jun 2023 07:48:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4KFLICTlpfIUjhlTIeVVXo9+E8RUQ03CGNu7ubaMLnhMY4wpGhRsQwuPmv33a2Jbg1hD3B X-Received: by 2002:a17:903:2347:b0:1b6:a37a:65b7 with SMTP id c7-20020a170903234700b001b6a37a65b7mr1401110plh.23.1687358885149; Wed, 21 Jun 2023 07:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687358885; cv=none; d=google.com; s=arc-20160816; b=g1d5WL+NWn22kK5JyoXmmktMwPYtF4j17pyBxfr+tSTuVpyQ/pe9UBl6Yazwb+f29B 80HGTZrl61sriZPkC7hLv5DodWXLLY4qK8x5yALZ8wOpFrunaR50cyuECS/S69G0AOGc m/88tYZBZY7kbwdnGuglZQDMk+hta73E+mSsGiLMTEpuibwgyXxcqBJmtWZni2QRDRPy HGNPubuPzwx3ic9CWoocLfsCKHDApsI33GkAFEoWcxgzCUFPss9NTrhuacdCUlh+uIB4 7rw0e57QQ0lcaue0JKwmsJlxqPDfzNAi1XTqu1uqEqKCsnQFH5BRgcDw9zF9tvRCGCOv RaUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BIB5wlsg1EGijWyF8j75rKQgBWBiWi5YkvKjCqAmdlA=; b=Q1SiE9H9h3j4u/eGePPBv8HjG+qPrkcFN8RVqhEVLlgKdECkyI4Q0uYDZUrPYz3tZd NDubV+W9mJRyJEZG6Js2qQt5HbOrNq1x9AeFSu6XWxK2w9v2c22CWfDdlqfPwfS62GUr 8FTWPExsWhqH+zMHBZ0XF7Tedm8YHyXGRt/m2HcWx68UslQk5qlrGgJ0RL/IxMZXRzqb K27+E1jsWjdvm2IpoR3h41PfoGSHeS/moA9gVagRF/tBCjvxNRkNjiE83mojsCBIOp2Y i4T9QV+Tg5DQ1TUhH33uQ7nOIR2pUhZXV11HtJUJH4j6kc8H/qtWiXFpRlS1lZM5G7pD sJOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hZPbxCk9; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a170902ce8300b001afd000029bsi1600361plg.581.2023.06.21.07.47.50; Wed, 21 Jun 2023 07:48:05 -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=@linaro.org header.s=google header.b=hZPbxCk9; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbjFUOka (ORCPT + 99 others); Wed, 21 Jun 2023 10:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjFUOk1 (ORCPT ); Wed, 21 Jun 2023 10:40:27 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A1291738 for ; Wed, 21 Jun 2023 07:40:26 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2b470330145so59577301fa.3 for ; Wed, 21 Jun 2023 07:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687358424; x=1689950424; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BIB5wlsg1EGijWyF8j75rKQgBWBiWi5YkvKjCqAmdlA=; b=hZPbxCk9XomiOQ86nLsKa9dg5VwY4wVkkRVEU+cDxbFEM+K8+b0BMrhwJnpdzq/0pz rCuE1hbYh8VV0GTWXM14TwPmqPvBWkle4n8WBK542wPk8521nEWj7NkXJcMaDrjttFam V4yR5DFCFFIcXklM/60ZbdaFtySrXICV+vjlfsokVGWjDPFVHyUQ3Y1qlqIXnRl97aV/ PLJkgb4n/lyGB9ibzT/VKBGZjLzaKarEAa6mAzHVeLR84tiestjLMnguFe8NI5QSWaBH leJnf2t9e+JPvcDCnoLkpHreNi/SOk8+ICal1qavMc32+jOF/InGmEPhs9dJ3JlgGBnI 41tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687358424; x=1689950424; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BIB5wlsg1EGijWyF8j75rKQgBWBiWi5YkvKjCqAmdlA=; b=kSOw1hOn1yHgTA5cu5XrgsXW94H05cpl7FJWh+MqsLNcuoIxOKT1Ma4UI8DWvi4eas CXm6JTQJn36XaLCQSKsS2a8OhmN4Ey2EFYaYZ4/CNy98gfmenjP29mSVS73XVapOFGs5 JfMIumTR0Olq6rJgFToY+3dSVGYQG/5IOWK93ty8GcBrzb6RSXpjFO+fQrgrzkchXUME pZPSLczZeYqbUmoYMd+Ke9RttnfgEP+UhE51DIP3yPidBLyYPX9NG9N+DiDY2m199sla f2AGDrPgTko7mHdnsb5ZCq016fMNs94ZkQIDxfAhcNSdJ6CQn/h8JtoKCcem4OhbDjns IBVA== X-Gm-Message-State: AC+VfDwhWSVAbHE8nl38gnc3iXTGmZQxIDR/kieqUoVrOn0d3g3v0XEM 9quBZ/ubuwjEBjMSmD1GzannuQ== X-Received: by 2002:a2e:b16d:0:b0:2b4:7875:dd98 with SMTP id a13-20020a2eb16d000000b002b47875dd98mr6627839ljm.23.1687358424498; Wed, 21 Jun 2023 07:40:24 -0700 (PDT) Received: from hackbox.lan ([82.79.124.17]) by smtp.gmail.com with ESMTPSA id l13-20020a056402344d00b0051879c4f598sm2689505edc.66.2023.06.21.07.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 07:40:23 -0700 (PDT) From: Abel Vesa To: "Rafael J . Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Greg Kroah-Hartman , Saravana Kannan Cc: Bjorn Andersson , linux-pm@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, Dmitry Baryshkov Subject: [RFC PATCH v5 1/4] driver core: Add dev_set_drv_sync_state() Date: Wed, 21 Jun 2023 17:40:16 +0300 Message-Id: <20230621144019.3219858-2-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230621144019.3219858-1-abel.vesa@linaro.org> References: <20230621144019.3219858-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 From: Saravana Kannan This can be used by frameworks to set the sync_state() helper functions for drivers that don't already have them set. Signed-off-by: Saravana Kannan Acked-by: Greg Kroah-Hartman --- include/linux/device.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 66c13965153d..bae11928ef7e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -995,6 +995,18 @@ static inline bool dev_has_sync_state(struct device *dev) return false; } +static inline int dev_set_drv_sync_state(struct device *dev, + void (*fn)(struct device *dev)) +{ + if (!dev || !dev->driver) + return 0; + if (dev->driver->sync_state && dev->driver->sync_state != fn) + return -EBUSY; + if (!dev->driver->sync_state) + dev->driver->sync_state = fn; + return 0; +} + static inline void dev_set_removable(struct device *dev, enum device_removable removable) { -- 2.34.1