Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp705312pxb; Mon, 16 Aug 2021 15:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo25KjYSY1W7IPqxtBZn9ZtTxEj/GC7dFsbrAGmggpefboRecNgOuj1PTclXyLoT6JmUjl X-Received: by 2002:a05:6402:408:: with SMTP id q8mr517882edv.13.1629154317003; Mon, 16 Aug 2021 15:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629154316; cv=none; d=google.com; s=arc-20160816; b=NNeFNStZAmwoHHZM8A/0Ag+/TWkswsAg94rKuYBh/g2XNeok7lwwym+VtrGYjVFNLW Vg9AJS0fao5ZYVjpYB+u/YA8pIpwH4M+zmWQiU0C26wxegCKt8Gp7vt8Jfkn9+eJ87ye wf++syW7Xt3v7vW7S/0UJdydp7lyymUGvlj6hz1uhmBrmFjo9iRxvnYEwxQ3Umn4U6uu eMg9DFQiLNs+f9SMNV8T/Uu/wyYnMrR9YeKhSh5jMNKj4gDso+TduRIHe/TlY7RNedun n+i7DDGBrlvnGHQewqCRhrKrAz/6Sa7L2cw+2PdbS53xJBh6LOKrtirHIG0XQeren987 3LDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FNF5yTfl26yRV2ZnsuQAzfTJ86jyXsPYWOJul2CIIxA=; b=YycpYsSlTi5zWtVFndVClX/D6ykv52daq6ThN8dtq7pqvqbEwyYZzGjDYfONl/JSDO XkSV42eGitFrGTkgeuu8QoHWgb+1cJ8rMRS0wIwzgaxJEV7+RQILox+IkYGFew4+p+WB A7j83V+C/2akVRBRCWk4TcHZWRRM1pWJlT9sF35b4xTHqmw3ohjFCncp1ml+zhO57KkS 9NjoG0DfBwiHWoesQPUvbPiGVMGmXZepF1wEemFmywrYTnGOSQyokZfvFE7jTTSe4XAG MnIN5ZOIPq6vwsrEIGedn/Aocp3L//VY/KaitwEl/9kc1DBGAfvTx6tw66FE/WnK4qaE Mh0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oDjyNYYp; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id um10si257088ejb.57.2021.08.16.15.51.33; Mon, 16 Aug 2021 15:51:56 -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=@linaro.org header.s=google header.b=oDjyNYYp; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232552AbhHPWuw (ORCPT + 99 others); Mon, 16 Aug 2021 18:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232444AbhHPWut (ORCPT ); Mon, 16 Aug 2021 18:50:49 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06A9DC061764 for ; Mon, 16 Aug 2021 15:50:17 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id d16so11596625ljq.4 for ; Mon, 16 Aug 2021 15:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FNF5yTfl26yRV2ZnsuQAzfTJ86jyXsPYWOJul2CIIxA=; b=oDjyNYYpKlqJROuUn6VAmXIcYHiu6KQoGMGqHi3LT/irIYzgdbpbgayMX522y/+rd/ jnHlAxW6jlIvUp6V+6fvpzHR4DETHRN8cH/swJifdTkk6BsMWKFMWWMotDhKQOOKU3PC iMUf55Iq5l7WJvdXq+WVb3ngr23evdvduoWLIYk2prD0RbgKiMADcl3Xpb4cSyV9WjLa mbAVTODa66G8a4RNboLzF3QI9emyb2cF6Auk+NLtkwzknbBOV+j2d+eJAtfwbqsbVNL/ 6T3B/93fPiq/Mst3eXuYNImGCpN1chnz0zkiPNxsIyQ9HpUuxdm7gVAJ63J9+o8fVWaV jHTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FNF5yTfl26yRV2ZnsuQAzfTJ86jyXsPYWOJul2CIIxA=; b=iHcRIUP3ubDlB4rcQKxKShWD6C0mU7bBtBdKC7fZRLWY7fwtEZewYZUtIUtlEowdYi tdfRDqVnGftndnDD0zrnqkeqYoE8YtzRwku8kHVs8F7nViI5jHdEtkaFzRi9OBA8A3+O SfRcIl6PvdGOnC3A2WEE4hRbsxCVZ+6vkABzZ2QdOyRHMJMxY1Ap6Zfkatd4qQ+JDpU+ /Inn22L246ebZqPiOVUxeNI0KIm7L6jQC8DkLK+9tEuTdmpLW30duXdu98h9dzt4YA4J GmNeAqT0zYHU36/LnggHZffRdt8WX4KiJu4CQnAcl6mgac6cvvIgH8jca2w2Lj96PGza 6GEw== X-Gm-Message-State: AOAM533hsi3jYduwQaELV2fnF/Glric9w4RlhCC41+vVwbkeiy7W/E4Y VusnWixRKz6oU8e2lMY7p7oyxHVuvVhrBrizXfGU9atf2e/oWg== X-Received: by 2002:a05:651c:1507:: with SMTP id e7mr463144ljf.368.1629154215340; Mon, 16 Aug 2021 15:50:15 -0700 (PDT) MIME-Version: 1.0 References: <20210816082836.67511-1-aardelean@deviqon.com> <20210816082836.67511-2-aardelean@deviqon.com> In-Reply-To: <20210816082836.67511-2-aardelean@deviqon.com> From: Linus Walleij Date: Tue, 17 Aug 2021 00:50:04 +0200 Message-ID: Subject: Re: [PATCH v2 1/5] iio: st_sensors: disable regulators after device unregistration To: Alexandru Ardelean Cc: linux-iio , linux-kernel , Denis CIOCCA , Jonathan Cameron , Lee Jones , Andy Shevchenko Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 16, 2021 at 10:30 AM Alexandru Ardelean wrote: > Up until commit ea7e586bdd331 ("iio: st_sensors: move regulator retrieveal > to core") only the ST pressure driver seems to have had any regulator > disable. After that commit, the regulator handling was moved into the > common st_sensors logic. > > In all instances of this regulator handling, the regulators were disabled > before unregistering the IIO device. > This can cause issues where the device would be powered down and still be > available to userspace, allowing it to send invalid/garbage data. > > This change moves the st_sensors_power_disable() after the common probe > functions. These common probe functions also handle unregistering the IIO > device. > > Fixes: 774487611c949 ("iio: pressure-core: st: Provide support for the Vdd power supply") > Fixes: ea7e586bdd331 ("iio: st_sensors: move regulator retrieveal to core") > Cc: Lee Jones > Cc: Denis CIOCCA > Cc: Linus Walleij > Cc: Andy Shevchenko > Signed-off-by: Alexandru Ardelean That's a valid concern I suppose: Reviewed-by: Linus Walleij But as it now occurs last before return 0, can't we just solve this with a devm_add_action_or_reset(dev, st_sensors_power_off_action, *); of some kind and let devres handle it? c.f drivers/input/touchscreen/cy8ctma140.c Yours, Linus Walleij