Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1017284rdg; Fri, 13 Oct 2023 07:58:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJjOSiehnjIlBc2ziOZw76qMw9A0vHXjHCEfMH1HpqskymwEBPNPPXY1o//Rr3kuasn3gb X-Received: by 2002:a05:6e02:1786:b0:34c:ecc8:98e7 with SMTP id y6-20020a056e02178600b0034cecc898e7mr36175113ilu.9.1697209128943; Fri, 13 Oct 2023 07:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697209128; cv=none; d=google.com; s=arc-20160816; b=d3ITADymcupP5NpTxo8GWdIwOE2972bs3uZTMZVxcBb4MRzxojD6MowyDgDHbn9ots VSn4JwFauoGtCpGoUJyMB4yg4EmCZgqBo50/GvrYW9t3J9RZ6JHX7d3Mya3UVh1v/WvH vig7X5pu9szFTvWr3620hCIqNAfuQOCO75TN+b8AYQEFWZqvRfFHRm/sbV32EPcWek7a w3yb+mcekKPUd2BVJDCkDOtcHortXmm41wrv4XMIX1ZhZQFBzv/IIk4Kyp1V7AZTmHJz wlyjN891lAqyq+8GI0OmGMpEmNSr749wDURcyLWTy9zQnzBT4eb23iThgelmmQljbpzR 7LBg== 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=8vN/EQduG3M1BIt7ikUdadEU7isSkOe2odZvLaevXKE=; fh=Wpq9ZzURCX+mS2+jesXnWluZ65Td7r3l87AFPyZ6+AY=; b=hVnxRKWsz4vtVT7s0mQ8QpB61f3Q9xt3hoQOUKDp5NHShQbG5KzRcYccTgpRHrTQK9 V/Ep6+xNaqg4sby8r5byAILXQjnCf7sSDeuFMQ+MMlCX8psf5ZXVXzkP03xccyxPr0xC ojtzQsKeWhs/aQEQwInEl1TBJ5MFxDKO0u2UdmhTMI3IYE15KHDZ+SNyWeZvXIW5dXTh m8V8BzWpGxto9swXxgKZTClpG6+oHm/kReis1O8UghFrB3WOS8qNct+L0cd4DLEHCv3G 1gvb5HEzYpqWGzlNhR1JpzWiljURzgJGpujvPaR4wDep7OX1hLUhsrjfv4BG3OUbTBh7 4r8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mess.org header.s=2020 header.b=G10jsopK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mess.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id d19-20020a056a0010d300b0068fdff873f6si17695088pfu.173.2023.10.13.07.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 07:58:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@mess.org header.s=2020 header.b=G10jsopK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mess.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2AFFA82E7B32; Fri, 13 Oct 2023 07:58:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232226AbjJMO6g (ORCPT + 99 others); Fri, 13 Oct 2023 10:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbjJMO6e (ORCPT ); Fri, 13 Oct 2023 10:58:34 -0400 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC68D95; Fri, 13 Oct 2023 07:58:32 -0700 (PDT) Received: by gofer.mess.org (Postfix, from userid 1000) id 8D93A1000C4; Fri, 13 Oct 2023 15:58:30 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mess.org; s=2020; t=1697209110; bh=1WNpZCcvkShVfOmoZ1FtkNn5Y5oSEIRDiZYxsfcBt/A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G10jsopKsKYCgKCiyQthEgGH54hFDWr5Q5RLcir9PVaDE7NOSoHx4FBmloL3nGwy5 NKyDncoxuFMMPyn2BfFHBiHFyng7pVG+ya4mRky75SmUFlznpoKznyUhc4zhm9YHNQ /CvBnQXxK6srhJLUyj13EUm9CdyfrJ0bnsDeKHZ6qj3SSQDekNpL5rcFxRPkqHHpCr PLQF95mHK66Zm6zMn/gKl/nu8svw8kFRGujcV9A34R1J80Z4d0PRiliX3xeK4bVxL4 NxXsr7z7OZ2gLundHYyTQy0iyibFWpy0yQ3sTopVU1XpIxMTWs//geZSR4kPp5o5QT Wj8tay2uNQ7nA== Date: Fri, 13 Oct 2023 15:58:30 +0100 From: Sean Young To: Thierry Reding Cc: linux-media@vger.kernel.org, Ivaylo Dimitrov , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] pwm: make it possible to apply pwm changes in atomic context Message-ID: References: <9c0f1616fca5b218336b9321bfefe7abb7e1749f.1697193646.git.sean@mess.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 13 Oct 2023 07:58:46 -0700 (PDT) On Fri, Oct 13, 2023 at 01:51:40PM +0200, Thierry Reding wrote: > On Fri, Oct 13, 2023 at 11:46:14AM +0100, Sean Young wrote: > [...] > > diff --git a/include/linux/pwm.h b/include/linux/pwm.h > > index d2f9f690a9c1..93f166ab03c1 100644 > > --- a/include/linux/pwm.h > > +++ b/include/linux/pwm.h > > @@ -267,6 +267,7 @@ struct pwm_capture { > > * @get_state: get the current PWM state. This function is only > > * called once per PWM device when the PWM chip is > > * registered. > > + * @atomic: can the driver execute pwm_apply_state in atomic context > > * @owner: helps prevent removal of modules exporting active PWMs > > */ > > struct pwm_ops { > > @@ -278,6 +279,7 @@ struct pwm_ops { > > const struct pwm_state *state); > > int (*get_state)(struct pwm_chip *chip, struct pwm_device *pwm, > > struct pwm_state *state); > > + bool atomic; > > struct module *owner; > > }; > > As I mentioned earlier, this really belongs in struct pwm_chip rather > than struct pwm_ops. I know that Uwe said this is unlikely to happen, > and that may be true, but at the same time it's not like I'm asking > much. Whether you put this in struct pwm_ops or struct pwm_chip is > about the same amount of code, and putting it into pwm_chip is much > more flexible, so it's really a no-brainer. Happy to change this of course. I changed it and then changed it back after Uwe's comment, I'll fix this in the next version. One tiny advantage is that pwm_ops is static const while pwm_chip is allocated per-pwm, so will need instructions for setting the value. Having said that, the difference is tiny, it's a single bool. Sean