Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3196040pxj; Mon, 10 May 2021 21:58:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIe91N29/SsAKGC80z2Map59xI6zVmyVbgaruV6Qfdp9xsZTdZ9CWHYoJYd1BduvaaigNF X-Received: by 2002:a17:906:4a8c:: with SMTP id x12mr28995627eju.133.1620709130079; Mon, 10 May 2021 21:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620709130; cv=none; d=google.com; s=arc-20160816; b=hfGTXuUbf5Jk3pUas2HVnCgH45vWKCpDzBZssd2O+8/V2Kqvd2+lG4qntlD8DWh5kU N7LuqTi006k7ugSHudJNpuaLzGWHPgFFoMDFw5yC3QPyKui2oGrNgs26osoa11b9t1PG VsF9EO3smD0z6Bsl3HGO9+NmmMGGvx/qGo7BMEA5bB0b/vQWtQT6O7G2s2vnonstgXGn a04lYmKejxUhtWIk3oyHQHLFZ8HfvMxHBiOxj9E/sCSuy89hHSLFGOtfc5JEZg7gsvwk lG3DQdRp9CzXpISIeBjYq5egSO/MsuJem0wWObKLGMCJ7a1tJQQWP/BqjL1YMhqSOaru cvFg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=gUde+0C3uKFPjg4eE3AOOGn4QQ9yT5Sdvd4hkNYDw4A=; b=jjzxRqr3pu7sdHt31PEMf3P+YYBI65ZESlwuM6GzSuNOHeb3wp0HhkeQcnYPqE2fnL MuTskX1B4seY1c2ooB7WS44c1aVPa1l39keO+ixl65ikk0akDU6UKWGGRRyeg1Kk1HBD HqknDLe7wB2jwTk3LxprVQjSnZx4Sm49yPZ/8yS5A5guARHw/XGzntr228/tseDkv1tC eJf+PMScg8ScZQILYL/ml3Q5qKSB5bccGx5EW1CroI9sAkvIuxcjAM2gd97TDjDCkFa6 8pfedaPoSeY3aJm3Qwy3cEp/cEex40KM7As8cVk9SgMUfcIESbG3eyUA6dFBYUrGsxVZ 4CJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LMJvsyDV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si16011106edv.186.2021.05.10.21.58.26; Mon, 10 May 2021 21:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LMJvsyDV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230176AbhEKEzc (ORCPT + 99 others); Tue, 11 May 2021 00:55:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbhEKEzc (ORCPT ); Tue, 11 May 2021 00:55:32 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18F1FC061574; Mon, 10 May 2021 21:54:25 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id x20so26733511lfu.6; Mon, 10 May 2021 21:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=gUde+0C3uKFPjg4eE3AOOGn4QQ9yT5Sdvd4hkNYDw4A=; b=LMJvsyDVQRsdlaAdXNrDQEv/MOnoCVJzTk3qzuJniXNoy7oF3OEMZNz4aOC7iPkNGO U3qyPxZOu0vu5QHnKI0jTgRmqthh9yC3zykpCcQHq81SE0OnUtaXZHCYydZkaBmITod+ NmM0l4IBvbqFWEMGZ6UlYnD+iM/rZBeAmOgRspMLvW7Qep/s7r/tXO8c7kKs0hVuv6FD OfBXsBg4Cs/PaUIkJiGnxnsDG1CFewAqO7EyT2YxNfUBw0ns3Uhfr8dL2KeLtORdysgR i6zuh+QHFIDqoU7Pk4m2TVDRvUHTcbIklLT2uzx8xuILAaspv+Ofeb8q/HXNI2UKRnWR Tkqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=gUde+0C3uKFPjg4eE3AOOGn4QQ9yT5Sdvd4hkNYDw4A=; b=e4ld7cTjKl5X5/hfvrRF4HwPjHNYHPI/x8GDVmRDYrqymWQaE+qUFMzFqs4vqqbQ4p io+u12ZQgFqH+mogdIQkyIhQJsgqV/3ESBII9RW0nO8ls/Rq/O63d0iTL/pLCVsPsVIm Av2zkcjq6zdIs8sMVhVhxQPkdWhkhsAKR05jA2u5ZPtw89VvEi+OHqHruTHE53m3xt3/ 1BMsoaFMm/N/CK+lkKNrYVSYmCl/aE29u33XtWqtP16YPqgDJ4uwU8cSQqg8YSz4xEfr 2nvos3rUbb9ep+erlULNEsqP4fwvR5sLjjrRd8lbu60q02VyzquP+zt1QAHCYHP2+gAt xTjQ== X-Gm-Message-State: AOAM530DlujQ73AROhV2lwpno3deKUv6p/Zt0Gh6J4p7eXaF8mlCWBTD mYaG4penbNWwsnjrMMPklcc= X-Received: by 2002:ac2:464f:: with SMTP id s15mr19216179lfo.329.1620708863614; Mon, 10 May 2021 21:54:23 -0700 (PDT) Received: from dc7vkhyyyyyyyyyyyyyby-3.rev.dnainternet.fi (dc7vkhyyyyyyyyyyyyyby-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::2]) by smtp.gmail.com with ESMTPSA id v77sm2471474lfa.111.2021.05.10.21.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 21:54:23 -0700 (PDT) Message-ID: <4d980efbec6a63d3241c14c7afdbaf14459d3fb3.camel@gmail.com> Subject: Re: [PATCH v9 05/10] regulator: IRQ based event/error notification helpers From: Matti Vaittinen To: Matti Vaittinen Cc: Mark Brown , Kees Cook , Andy Shevchenko , Zhang Rui , Guenter Roeck , "agross@kernel.org" , "devicetree@vger.kernel.org" , linux-power , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "bjorn.andersson@linaro.org" , "lgirdwood@gmail.com" , "robh+dt@kernel.org" Date: Tue, 11 May 2021 07:54:22 +0300 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-05-10 at 14:29 +0300, Matti Vaittinen wrote: > Provide helper function for IC's implementing regulator notifications > when an IRQ fires. The helper also works for IRQs which can not be > acked. > Helper can be set to disable the IRQ at handler and then re-enabling > it > on delayed work later. The helper also adds > regulator_get_error_flags() > errors in cache for the duration of IRQ disabling. > > Signed-off-by: Matti Vaittinen > Reviewed-by: Andy Shevchenko > > > +static irqreturn_t regulator_notifier_isr(int irq, void *data) > +{ //snip > + /* > + * IRQ seems to be for us. Let's fire correct notifiers / store > error > + * flags > + */ > + for_each_set_bit(i, &rdev_map, num_rdevs) { > + unsigned long evt; > + struct regulator_err_state *stat; > + struct regulator_dev *rdev; > + > + stat = &rid->states[i]; > + rdev = stat->rdev; > + > + for_each_set_bit(j, &stat->notifs, BITS_PER_TYPE(stat- > >notifs)) { > + evt = BIT(j); > + pr_dbg("Sending regulator notification EVT > 0x%lx\r\n", > + stat->notifs, evt); > + regulator_notifier_call_chain(rdev, evt, NULL); > + } This construct sends own notification for each of the event flagged by the driver. My thinking was that sending each event separately ensures all of them are handled. OTOH, the comment in the even description states: > * NOTE: These events can be OR'ed together when passed into handler. So... Should I actually simplify this and just punt out all the stat->notifs in one event? That would get rid of this one extra loop. > + rdev_flag_err(rdev, stat->errors); > + } Best Regards Matti Vaittinen