From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BE3D15B97E for ; Wed, 20 Nov 2024 21:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138444; cv=none; b=TD+prTdBF2yw9ohz636e7ctixXi5PQ8nQtVwTcDzGx6AKnpWXpuNFTU2xWM20sWxoyQGlZWE1wbLMz5lUHe53iOHGa9DCUC4p1m4T1WtO6CSTHq0soA6MSbrV6PPkBPb84HnNdq7XLMiTdoQdoHapWlFKz42DK4Wxr0ztmDIXXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138444; c=relaxed/simple; bh=Xl1ucGBXN8Ab5O0eTwCrzfVk4oVpsNxeeYYkgyTO4wY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XLzYwIlaRfShlH2anW2Yvq/bTFpbkrR7ocLzVe7SEh1ReWf0zuISose4Ng5DmD2Jht8zQNhTvp/raJWCcyQ9L8rBERl5a+DGts4MqkRo4sgOm3jk8OFZsdHX6O0DPuSu09BX+CTKboKCb5GEOCdYu6dgcEN036GGCGbVxByKKZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=wuriinmc; arc=none smtp.client-ip=209.85.160.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="wuriinmc" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-29666708da7so214595fac.0 for ; Wed, 20 Nov 2024 13:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138441; x=1732743241; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VHXzVn+FU8SfAawuWvQ4fvCX8mEpHyw2bPUQ2RW2fhk=; b=wuriinmcL4FcZNRtcRO4HMfannXHXBdtNfM5sk1A+yEvqL32hwpQnxg1uXsUGfhDK0 4/fJoz8RyM1gW3KslFzlhpaDmlwuhM+zLh/mTDVnOLfDHZg7+g9gewVtnkjAusqBDWS+ zBzuGCqwygjBYUIQ2oDt8o0SFyBNnODAqkl93dwJaGDvhvsnogYuzl85oo7L7S704B0K Jq0LJhZxAd07TvyW638WuAlieOzB4T0nydumlCTJglV2mVV9vN44RkqyYG9gG95kEvuj JNXsfm3XYwJgE01hvfnOdjx4iXIaLTRLhjAGkM3eak887xIdpZdhmNYj4SZDTRIXQsLQ UVBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138441; x=1732743241; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VHXzVn+FU8SfAawuWvQ4fvCX8mEpHyw2bPUQ2RW2fhk=; b=n1AdnJAac1iiWyZidqotHE2xn9jmktyDOFayxj/lb7U4UAGBRh9+F44zlvcrFUHIVJ swgHsqHV+ARBUuMSs2wrZeJ/osCY4GxsQ5YUj/0TaTPuKo99r1bMArNgx7n3nQkGVtS8 0ByXWx3k2ANQ7+xSnwR6NYfd9OqVDdsEdNyioGl5pJgMle1QG/OUCOW06tvBdpbfGsDO K7LBArSvKobvzK0qbBDyeCRDCUOI5kL2A1w+lZhSI62WsEAXICe+N5MLsyzFnpoMGy1u SngwQSFKwz8hViL2NmOj/N0olXsXXmMj1hPhJJaVo2c/Cnjw2Nrg/NEW7lbx+Y70/TE/ VTRg== X-Forwarded-Encrypted: i=1; AJvYcCXI3IYDhbIU3eYbNDDmLZxLxja8O0DNQnWY0UwExYuJOK501u/rckynU0i3NpOBoe+JojNzfIy3DGwNk0s=@vger.kernel.org X-Gm-Message-State: AOJu0YxIdg42gMgpQi/uAd+1OQACHf2EzcroNuLpB25JcoinjKHm2pdM eV7JX3p3Q8DZt1x2GInj5s1Ak+edqqKaJtf7v98pO0UBKrwF+BOJYaqbVwChCLWrQJXJayWEare 5 X-Google-Smtp-Source: AGHT+IGmeO3UOuBcBMbAlPJkDaHTLSKEPkagM4+DYmypgIFQ2jzYAjNyXEq+HRTkEog+qDgqDQQpMw== X-Received: by 2002:a05:6870:aa88:b0:277:caf7:3631 with SMTP id 586e51a60fabf-296d9b157bfmr5121861fac.5.1732138441704; Wed, 20 Nov 2024 13:34:01 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:00 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:24 -0600 Subject: [PATCH 01/11] iio: dac: ad5624r: fix struct name in doc comment Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-1-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Fix a copy/paste mistake in the struct ad5624r_state doc comment. Signed-off-by: David Lechner --- drivers/iio/dac/ad5624r.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5624r.h b/drivers/iio/dac/ad5624r.h index 14a439b06eb6..8c2ab6ae855b 100644 --- a/drivers/iio/dac/ad5624r.h +++ b/drivers/iio/dac/ad5624r.h @@ -41,7 +41,7 @@ struct ad5624r_chip_info { }; =20 /** - * struct ad5446_state - driver instance specific data + * struct ad5624r_state - driver instance specific data * @indio_dev: the industrial I/O device * @us: spi_device * @chip_info: chip model specific constants, available modes etc --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19D471C4622 for ; Wed, 20 Nov 2024 21:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138446; cv=none; b=FlDEkKfJLF10F/idQ6cttMRDKXeUTy9bGUCxY1z0e4RbHviYfqYMMfYUOApn4jASX9MTG+myKZ7xPz5/uDwM8XWlRl7VBf29MRFGP+0sbKoOnla/MS/RFgZNm7ZRA7zknaeMitkqe5nkwktNGFrbHNCFKJCgzyjC5Zb+PWIHaWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138446; c=relaxed/simple; bh=CDa4K/qMrZy2Vk2sOAtkcJn6wgLoYlOypmZEq0L+kMw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P/TOBHRr46l3UQNIQQrcleKiyCUT1UjTsoBx1s1ar17CpYS0NQkUFOL4QdRVhi9udAJhFulMyX2YAsbyhfgATQhC7HhWCiPn2JYG7ZGHlfiB0dTUTojaX/NNiRaxZxj3xb9o8cHZ65c5awbgGUiVrrmZtzcFT3vfNd8MCrTSB4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=PpZ1AOlr; arc=none smtp.client-ip=209.85.160.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="PpZ1AOlr" Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-2964645d2b7so219921fac.2 for ; Wed, 20 Nov 2024 13:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138444; x=1732743244; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yw+ajRa8KccOrwd0yiTrzG6Wjr5FRjEkQmVdFiXTvr8=; b=PpZ1AOlrfZcpa39ELZXWUwBllV9lPpzBuI4mRuUclngjPu3Ows2SBDzpcRj5XARE5o 728I0JhdLyUj9CupRkWG+ec36eKSIsVGo5nEfm+0Z/AVdZgkE0rgtNv2Zslr8yZLA/vQ gCepM6Hg8so+gEgRyDsWDqmO2K8y4womYlqhMU5NV1KSDJueTxGMV0W1q1qatWrG5W4i QJgMyiF9PZ6BBz++Znm9+FgH1+uspHA3cjCupVj0N7KkIwKABFB9fyNWXoW+Crprpxsq Hn1xNcyXNQ0DLB2IAd329yFbmb9+xFQchJeIrobpFFpCWUxod60ncNgjxoNbzRRaPPd2 PAvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138444; x=1732743244; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yw+ajRa8KccOrwd0yiTrzG6Wjr5FRjEkQmVdFiXTvr8=; b=WooNrvpNFIhmPjMDcanVDHbQ6eCr0c8G6JAuwDvGsPiyURkr4sO+w+xRYRnxMUwMOY yBRWyjw4eRhy097kBaf5oefBiewUufvSQmOzxAA67+H1WJujxCXY7BPSO8CRBDnrzWHW YPdB8gEhRh3DzHTgLlt1vFSHJ7cUDyuB0g7LOKFwgnJ/nthMdQVub1MZGpOgDRvp27F1 TD8HAoI9nlZA3bAPrg0v6e43Sd9rNZZO4zm8cJCiIrdK/NxrtWZavCNGwkT7TqdOLx5A cv92M/vFNTureqcGrautk34V1vmNe0+QWgBDScRwqZty4kuQ7AaRC+dN1tUHpgwJKfu2 fuCw== X-Forwarded-Encrypted: i=1; AJvYcCW5YyDk/aiGAE2x4OhiqWvQqO+lyAMvB0RceF4K1UTCPiI+7JNGh0HSGMvzpEEwNjp8x1J6cBiR4wQeD4Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzEVGeuRJzvs8k/Df9rrQZ/7FRkPbWd99h+p28Kc3Oshq6EU7Mr j7qNx0ENWAf4CME7zZ7ufPzVJe4RnDrFsjNRoOh2WzDyG88rEkHzY+PNQomiw3E= X-Gm-Gg: ASbGncv6vIXidyBiRXELmviBu0HtDr8EPfYCn/5Zu0jqxZSSV5yQz13fioBoOk0T7EE cjVh77JO+J1NfRIhih53hZVSm81+voL/IQ2ejT5GB5tV5cCVRaHb5J32B6DNLBmX5R/XajTAnwz V665QPRcJW6agmuJU3khqOtyKtta+JUJanvnQ2FT1f7/Et127yXo+l/tA1PU+PLDi7R6pMqr33g 38ZYxOUVvkdBLgM6NMU9+mw4Ro6BdlrzhOZsXO3dciOcKYH557xANW1shT1q1A5pqENiU/fdP7N 5Hkbqw== X-Google-Smtp-Source: AGHT+IFt3OYUTddzXeyXQxe7QYviNNpiS7sqQ7XHszAFayFyZfwLOK9wvkkKMZ1SNhQi+bvcF8zekA== X-Received: by 2002:a05:6871:d084:b0:27b:55af:ca2b with SMTP id 586e51a60fabf-296d9b5cd91mr4192758fac.11.1732138444351; Wed, 20 Nov 2024 13:34:04 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:03 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:25 -0600 Subject: [PATCH 02/11] iio: dac: ad5686: fix struct name in doc comment Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-2-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Fix a copy/paste mistake in the struct ad5686_state doc comment. Signed-off-by: David Lechner --- drivers/iio/dac/ad5686.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h index 760f852911df..5b150f344fda 100644 --- a/drivers/iio/dac/ad5686.h +++ b/drivers/iio/dac/ad5686.h @@ -115,7 +115,7 @@ struct ad5686_chip_info { }; =20 /** - * struct ad5446_state - driver instance specific data + * struct ad5686_state - driver instance specific data * @spi: spi_device * @chip_info: chip model specific constants, available modes etc * @reg: supply regulator --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB08A1C68BD for ; Wed, 20 Nov 2024 21:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138447; cv=none; b=p7Bkp0vB90KxzhoDvJZRpcvFB1hwXEr0ibbNbO/CvBSnZzOaSgIme4rnFyU5iW3defdGb9wDauHXkwU02IXy31rzIpNWtQ/eI9UOBEz8wsaU2WstZRs8qGcvUCEk0gV/CFUxesjXBV15iyekKRN+DZjpnXtWk9JftVg598h/9jQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138447; c=relaxed/simple; bh=fa64DP6YB+c3vhGXH9bhQQ4ElBrLFlB1lU4ITho9Z44=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dOTZG2FOaWXpj9FhTiI7HFI3s2oAeTWCgGwjyl+JkG+aZpUxzdE7c/U5tw/2JyeCcyOVduSb3o34TYOx//n5+Iq3QJYujOrIvhRVbkzDlRhgYkNU6PPJwjGVk80o4IeY+ZQlDsw3dkQ+dqA/lzh0ILJ3hJAo4UfGia5KOXbsOog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=qC7HF0d7; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="qC7HF0d7" Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-29685066b8dso201292fac.1 for ; Wed, 20 Nov 2024 13:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138445; x=1732743245; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lpOmExH/YBf4JnNMGa7Hs+sH1CTkB96FSCJMK4b4hAo=; b=qC7HF0d7DVxghbEIJix3Oqle7MwZQyvj2cch0778I2tsESS743K0YtUJGr7Aj2G4tf Ewjhw/Ec6QRn/opHi0Ua9LaTXH9RfoUqfj2ZUyWhunFsEe7TOdWcH81oj9R9Ahq1K1OD vl7sVWBqJx5DTtLwSbVSnxq/NKzcv7y7u8B4RazxULgmPN6bRZzyMng7Ab/CeeItYl8l IniMiNed+th9OUfccHfd/ekaFETw/UZt6pvvfvgcSXveWIWHB9upxCFLyrSAy0ujZ8Gb 2bmfU2GfXZvbl+HPD0RWRh7SA4T3rnPrEbX1lxHNTeF2nOOIpPMJHiuWVLqHJ5pzKHNO gqKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138445; x=1732743245; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lpOmExH/YBf4JnNMGa7Hs+sH1CTkB96FSCJMK4b4hAo=; b=dZhJx3VEywARKmzgzpEq3vxVuIwP3tL5ERbpDxgA08tlRd4/fRp8K+zHxbkdej0IyF WUCKwolbwFExfFnPM1HeaoZMv+WopvJ3EEuIVT0xNfIaS5YqvGPgRPSKk/UGQZy806qL uDLJtwOIesZWyV2QLz8FP8kSGZIvdM8tNou+MRd0S0Nf3dloAGn5ADJKyZl37YmqWjyG buFxqJECWkmIknngFJM9rFZWCF+i4wx7RBah68QYosDIFpx6xqb393uoZ/HpFHIEOhBR s1TqnHJ7Ot1DdEZM5LVyqddX8zefDQuGAKzBfSNzg1g2plYaKtb/OWzQS68Jrdrndych GGEw== X-Forwarded-Encrypted: i=1; AJvYcCWSBgJ/nYH+lAuQmYw68tADGHcz+0yfWThlsyuwvLBUdpMJJMzqtQ/30JbwWj0KV65D4aoT0YQevSH79lE=@vger.kernel.org X-Gm-Message-State: AOJu0YzIsdODypTPS8PwUsLmGMPER5fUALmeMGeFpQSXrwQ5r3T/gppk ag2ROhALgTEVPrcaiyGZvlmM3Jh1ousYkChi3ifEhzmrGfmfHsm2Nkk7vkJ9QNA= X-Google-Smtp-Source: AGHT+IErwTdkpK036l2hmrQRg+PDO2T/siAI4WUnVHxNCqr/YbIrLdH2n8uBYHzhdrFruzr/J2XqQw== X-Received: by 2002:a05:6870:a413:b0:287:7a8c:4f15 with SMTP id 586e51a60fabf-296d9b5c38cmr4696763fac.20.1732138445079; Wed, 20 Nov 2024 13:34:05 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:04 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:26 -0600 Subject: [PATCH 03/11] iio: dac: ad5686: use devm_regulator_get_enable_read_voltage() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-3-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Simplify the code by using devm_regulator_get_enable_read_voltage(). There is a small change in behavior. Before, all errors from devm_regulator_get_optional() were ignored and assumed to mean that the external reference supply was absent. Now, only -ENODEV is checked and other errors will cause a failure to probe. So now, this will catch errors, like using the wrong data type for the devicetree property. Signed-off-by: David Lechner --- drivers/iio/dac/ad5686.c | 53 ++++++++++++++------------------------------= ---- drivers/iio/dac/ad5686.h | 2 -- 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c index 57cc0f0eedc6..a8a38879fc40 100644 --- a/drivers/iio/dac/ad5686.c +++ b/drivers/iio/dac/ad5686.c @@ -455,8 +455,9 @@ int ad5686_probe(struct device *dev, struct ad5686_state *st; struct iio_dev *indio_dev; unsigned int val, ref_bit_msk; + bool has_external_vref; u8 cmd; - int ret, i, voltage_uv =3D 0; + int ret, i; =20 indio_dev =3D devm_iio_device_alloc(dev, sizeof(*st)); if (indio_dev =3D=3D NULL) @@ -469,25 +470,14 @@ int ad5686_probe(struct device *dev, st->write =3D write; st->read =3D read; =20 - st->reg =3D devm_regulator_get_optional(dev, "vcc"); - if (!IS_ERR(st->reg)) { - ret =3D regulator_enable(st->reg); - if (ret) - return ret; - - ret =3D regulator_get_voltage(st->reg); - if (ret < 0) - goto error_disable_reg; - - voltage_uv =3D ret; - } - st->chip_info =3D &ad5686_chip_info_tbl[chip_type]; =20 - if (voltage_uv) - st->vref_mv =3D voltage_uv / 1000; - else - st->vref_mv =3D st->chip_info->int_vref_mv; + ret =3D devm_regulator_get_enable_read_voltage(dev, "vcc"); + if (ret < 0 && ret !=3D -ENODEV) + return ret; + + has_external_vref =3D ret !=3D -ENODEV; + st->vref_mv =3D has_external_vref ? ret / 1000 : st->chip_info->int_vref_= mv; =20 /* Set all the power down mode for all channels to 1K pulldown */ for (i =3D 0; i < st->chip_info->num_channels; i++) @@ -505,12 +495,12 @@ int ad5686_probe(struct device *dev, case AD5310_REGMAP: cmd =3D AD5686_CMD_CONTROL_REG; ref_bit_msk =3D AD5310_REF_BIT_MSK; - st->use_internal_vref =3D !voltage_uv; + st->use_internal_vref =3D !has_external_vref; break; case AD5683_REGMAP: cmd =3D AD5686_CMD_CONTROL_REG; ref_bit_msk =3D AD5683_REF_BIT_MSK; - st->use_internal_vref =3D !voltage_uv; + st->use_internal_vref =3D !has_external_vref; break; case AD5686_REGMAP: cmd =3D AD5686_CMD_INTERNAL_REFER_SETUP; @@ -519,40 +509,27 @@ int ad5686_probe(struct device *dev, case AD5693_REGMAP: cmd =3D AD5686_CMD_CONTROL_REG; ref_bit_msk =3D AD5693_REF_BIT_MSK; - st->use_internal_vref =3D !voltage_uv; + st->use_internal_vref =3D !has_external_vref; break; default: - ret =3D -EINVAL; - goto error_disable_reg; + return -EINVAL; } =20 - val =3D (voltage_uv | ref_bit_msk); + val =3D (has_external_vref | ref_bit_msk); =20 ret =3D st->write(st, cmd, 0, !!val); if (ret) - goto error_disable_reg; - - ret =3D iio_device_register(indio_dev); - if (ret) - goto error_disable_reg; - - return 0; + return ret; =20 -error_disable_reg: - if (!IS_ERR(st->reg)) - regulator_disable(st->reg); - return ret; + return iio_device_register(indio_dev); } EXPORT_SYMBOL_NS_GPL(ad5686_probe, IIO_AD5686); =20 void ad5686_remove(struct device *dev) { struct iio_dev *indio_dev =3D dev_get_drvdata(dev); - struct ad5686_state *st =3D iio_priv(indio_dev); =20 iio_device_unregister(indio_dev); - if (!IS_ERR(st->reg)) - regulator_disable(st->reg); } EXPORT_SYMBOL_NS_GPL(ad5686_remove, IIO_AD5686); =20 diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h index 5b150f344fda..62eb309711af 100644 --- a/drivers/iio/dac/ad5686.h +++ b/drivers/iio/dac/ad5686.h @@ -118,7 +118,6 @@ struct ad5686_chip_info { * struct ad5686_state - driver instance specific data * @spi: spi_device * @chip_info: chip model specific constants, available modes etc - * @reg: supply regulator * @vref_mv: actual reference voltage used * @pwr_down_mask: power down mask * @pwr_down_mode: current power down mode @@ -130,7 +129,6 @@ struct ad5686_chip_info { struct ad5686_state { struct device *dev; const struct ad5686_chip_info *chip_info; - struct regulator *reg; unsigned short vref_mv; unsigned int pwr_down_mask; unsigned int pwr_down_mode; --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CA421BC086 for ; Wed, 20 Nov 2024 21:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138448; cv=none; b=lbpMxsn8eaFSHwHd3Nz6MK7DQ9f5euaQKzZfgOiPyOEJjDqnN/dlhXQGxNPh2hL6wL3t7FazrVFJEZHcSKiMFn4hLBLcsA4HzvZC0FUmz7gPC38BuowrHi12WKnYlhyQHsryHM7T4ckuN4cVrK8T5lg9FaXN7elFW9mrw/Flrjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138448; c=relaxed/simple; bh=zb0iu3LsZDbGiMZnDHvWU/LC6XEX03tvjXgY85pW72E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QKLEIF46GZ1ETzcC6tppQReiE0scMJ3KN2U/6BPbJoxcg5ugwvTyiNDs1gJJ4sWkvWXakHFW82l0wzlITK0j5MNtNJqMnHTG5JeGtMSnWDNJLe4jnMQiGTn2iHdXhqkDzPzdCK21lWP28jIuBbE3BM4rwgXLYiI81l53UOBik90= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=OiLx6adM; arc=none smtp.client-ip=209.85.160.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="OiLx6adM" Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-27d0e994ae3so174452fac.3 for ; Wed, 20 Nov 2024 13:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138446; x=1732743246; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Y4a61Dd9tLHdovtexXvQ3Ave9sPehtoMEhgbGtikgl0=; b=OiLx6adMjziyZAY/MTplYcT/Fg/+82HsOmZsltwuX2c7G1Jg6/pRecrRky2v/Hz5Po alZQDr0Z5LGXdZCu6SpPMOh9qMyIkVEQpFyNy6wcZAskpLvM24x7cUEfJkGdEUsVRnuM RcVxHLdZASEPHvTqffguQ+orpAH9o/tcMI46H0CkPB1+inb41VxYQoVo7iSF4C9SMwob Ymle3v0jbXbz+eGR3AB4L7BgQAZmQ7WaHRDpoiPth3M8vxmtfVW25Y83XpP4jH8LYhzO airYjxcaIyVlGAorZFl1eindLJ0YGxc9WzDBlQSU1mtaR9BNEvpXr2Ll4dw5yO1/fCHB B1qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138446; x=1732743246; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y4a61Dd9tLHdovtexXvQ3Ave9sPehtoMEhgbGtikgl0=; b=dryHHGBeF4zWlXTlrNjhwAe/FvY02pyRVjIySfX3v9ak9kT6of/RyPBcMY2RCttPau vOwRbMZ10M3kevpM6/rTdrlWFjRqq5LLQaSm6eBJQs9+kd3Htq4lRMHPL9jPCtk9pMgN ppTHJnlFC/Qn0a8q3zkDvUZj+oHYQHYhwMWaQX2P/Ik9xRbXbsRsKMMPz1LXgF69CtsN hZAmMbcugDMvsKFeTZBn71qbRAsvTCax9UzeOJ2WsC1T9Uz8q+eiCaWL55lNWDDSf//U eAQINEcNECFuSgmnAXsoiu0Xe1Gyaega1dBccQs54EpvT6LR3ira2J2imT4fg+9/WQFJ fWjg== X-Forwarded-Encrypted: i=1; AJvYcCVgAN8IGuyBMGWmaT6W0PlbCWR/3ef1sW5xvhc2MRZQmdAou2MFxa2uxyts5Slgu4nonAUEAGie2vklsyk=@vger.kernel.org X-Gm-Message-State: AOJu0YwJpWRjQhcDMybd/5FSoy8pJ5cbjaNYjNSkG9c1Q7pQZzbCIg4H KJ3A4rrU7T90OCc15GVZOQQB3OOOaUwgiBgZMqczGGr/kadjuMTGH+1JSwmvL8w= X-Google-Smtp-Source: AGHT+IH0OnevfIErmH2Ja2B5PLvY8pZDo/UqVPro9E1gpKlbBh56WhUqCHUnie2nukWwp5F+H26sJg== X-Received: by 2002:a05:6871:112:b0:297:212:81c7 with SMTP id 586e51a60fabf-2970212a7demr252983fac.37.1732138445804; Wed, 20 Nov 2024 13:34:05 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:05 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:27 -0600 Subject: [PATCH 04/11] iio: dac: ad5686: drop driver remove function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-4-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Remove driver remove callback for ad5686 SPI and I2C drivers. By making use of devm_iio_device_register(), we no longer need a driver remove callback. Also since this was the last user of dev_get_drvdata(), we can drop the call to dev_set_drvdata(). Signed-off-by: David Lechner --- drivers/iio/dac/ad5686-spi.c | 6 ------ drivers/iio/dac/ad5686.c | 11 +---------- drivers/iio/dac/ad5686.h | 2 -- drivers/iio/dac/ad5696-i2c.c | 6 ------ 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/iio/dac/ad5686-spi.c b/drivers/iio/dac/ad5686-spi.c index 8ba2ea70451a..79cfae7a1048 100644 --- a/drivers/iio/dac/ad5686-spi.c +++ b/drivers/iio/dac/ad5686-spi.c @@ -95,11 +95,6 @@ static int ad5686_spi_probe(struct spi_device *spi) ad5686_spi_write, ad5686_spi_read); } =20 -static void ad5686_spi_remove(struct spi_device *spi) -{ - ad5686_remove(&spi->dev); -} - static const struct spi_device_id ad5686_spi_id[] =3D { {"ad5310r", ID_AD5310R}, {"ad5672r", ID_AD5672R}, @@ -126,7 +121,6 @@ static struct spi_driver ad5686_spi_driver =3D { .name =3D "ad5686", }, .probe =3D ad5686_spi_probe, - .remove =3D ad5686_spi_remove, .id_table =3D ad5686_spi_id, }; =20 diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c index a8a38879fc40..b848b076851c 100644 --- a/drivers/iio/dac/ad5686.c +++ b/drivers/iio/dac/ad5686.c @@ -464,7 +464,6 @@ int ad5686_probe(struct device *dev, return -ENOMEM; =20 st =3D iio_priv(indio_dev); - dev_set_drvdata(dev, indio_dev); =20 st->dev =3D dev; st->write =3D write; @@ -521,18 +520,10 @@ int ad5686_probe(struct device *dev, if (ret) return ret; =20 - return iio_device_register(indio_dev); + return devm_iio_device_register(dev, indio_dev); } EXPORT_SYMBOL_NS_GPL(ad5686_probe, IIO_AD5686); =20 -void ad5686_remove(struct device *dev) -{ - struct iio_dev *indio_dev =3D dev_get_drvdata(dev); - - iio_device_unregister(indio_dev); -} -EXPORT_SYMBOL_NS_GPL(ad5686_remove, IIO_AD5686); - MODULE_AUTHOR("Michael Hennerich "); MODULE_DESCRIPTION("Analog Devices AD5686/85/84 DAC"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h index 62eb309711af..e7d36bae3e59 100644 --- a/drivers/iio/dac/ad5686.h +++ b/drivers/iio/dac/ad5686.h @@ -155,7 +155,5 @@ int ad5686_probe(struct device *dev, const char *name, ad5686_write_func write, ad5686_read_func read); =20 -void ad5686_remove(struct device *dev); - =20 #endif /* __DRIVERS_IIO_DAC_AD5686_H__ */ diff --git a/drivers/iio/dac/ad5696-i2c.c b/drivers/iio/dac/ad5696-i2c.c index 81541f755a3e..a56a7a410111 100644 --- a/drivers/iio/dac/ad5696-i2c.c +++ b/drivers/iio/dac/ad5696-i2c.c @@ -65,11 +65,6 @@ static int ad5686_i2c_probe(struct i2c_client *i2c) ad5686_i2c_write, ad5686_i2c_read); } =20 -static void ad5686_i2c_remove(struct i2c_client *i2c) -{ - ad5686_remove(&i2c->dev); -} - static const struct i2c_device_id ad5686_i2c_id[] =3D { {"ad5311r", ID_AD5311R}, {"ad5337r", ID_AD5337R}, @@ -116,7 +111,6 @@ static struct i2c_driver ad5686_i2c_driver =3D { .of_match_table =3D ad5686_of_match, }, .probe =3D ad5686_i2c_probe, - .remove =3D ad5686_i2c_remove, .id_table =3D ad5686_i2c_id, }; =20 --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60E4B1C8317 for ; Wed, 20 Nov 2024 21:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138450; cv=none; b=gqX9fMNAFLUrzQukCzrTkNh0XJPS+5Mr3x+RwqDtKDgyMN85itEVtzKjbNPDr2lKgjl7Fd+iiLwPvXQDflXgIAQLPLP1a0h6wmA+Xd4DQVTTZuBaynRF6yo147Z2+hk1ZjHUTxvAU8mK1jrxVaHPzGY5BN3T0BQo+B1eFAaxE5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138450; c=relaxed/simple; bh=wQqTKAxl5O+P4WIe2Sj1MmeNWLBkM7Jg9ETyJxQb1mc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G20XrEult0N3GY1ktwS4fcQwA2YAJMFhk2UCC+isWg50i0n27QrEgZtVq+yfoF+YFueWfRq/xzu7i9zZuDMMtyaA8ZncalcMX2yVkGyq7jGj0Ywo3LGl8gXQMQSO65Q+c4lIi80bTXQwPoqMyXx9Cm5WqbxrTzUGVcUOz3ospPU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Vw1d0/In; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Vw1d0/In" Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-2951f3af3ceso198673fac.1 for ; Wed, 20 Nov 2024 13:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138447; x=1732743247; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0yNbYsdWlVja/3AQCgkcR1Uui9r2S29rAsSTHquAG0Q=; b=Vw1d0/InHsfUvLF3M68Bm5W3atZb1/KnZvVo+38ME/2AJm0pYUMWZDNRHYwuwaIWkO RKNwHKqYHgHXyAP0dn+rY6tjuXreKByw/jYh/plxMvaQKqXn0Q+Olr2pAKMLmbH7dMyu 0cGvw7AW7RpbqhSuWz7XHeXNQYd03sAtb4IBczefk+r5Z7jJnxOVX/WKXgxQleogWYrr i8Gn5q3LYKQF6WMtfrJBos9cVXPTRUH8SjFeVuGtCqJOU/6q8B3iQfeCGA0xLG9eRH9B WrH66EF4l35a7t8HfR22VOlORDbwDxpPRYBstAiilIu/juMQK2oCEAcRhUJNjbEeUS5Q kLyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138447; x=1732743247; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0yNbYsdWlVja/3AQCgkcR1Uui9r2S29rAsSTHquAG0Q=; b=UDqFtn/konCr5E07Rq9qKQhg/8YgVtOCjjbmvk9d7w8letphamDAUVUqMS6GcGfpLa 3DeftkYcAr218PdIF13CDZgLIqsT+6SABYacwVHbVaHsLB6OSsloBfhipQxVoThEes3+ PCucJRxlPLzq2CiGrMQN4rINfsphU+b/ntIJmw+akk4f6jPPPGG+kShUEPPTQZtl1z8d IkkwniDPjGi/vPW8Wkc8MkZRE6TOQTBOGA1lirK2drVxjmIqhd6Wyto7iMtfqxr7Z0n7 Isz3fMKalDJihIPVG/4Gn2aFwZR3uC6cHBvqTGFMD6WZ6hsfQhWBt2LEISAZwyUd+LA7 e8uQ== X-Forwarded-Encrypted: i=1; AJvYcCXMm+38aoc2tq+6vqzSZDYmypob9/mfeTgl11zldvuo1HH1HzI8677FQ0w7oGIAqPWtlCstZScFm+yVRZs=@vger.kernel.org X-Gm-Message-State: AOJu0YwLvSA+vwmv5ODI25lhGh3zlukj0JYDiGrMheIohrMJ3z29w9ev wJDJ5dxqoNC6ya6c+BTYHFEuEqO6HlaYuJUT0iAskjvE4+7iM5iTSVRaYd4VdsE= X-Google-Smtp-Source: AGHT+IGRosbHi0euPzLEM1A+4BnjkurMVpdhu51uw/buTqQP1Y4uX+GnXnQoYUZZExG+cGsnPGkI2w== X-Received: by 2002:a05:6871:69c7:b0:287:6f4:1ac5 with SMTP id 586e51a60fabf-296d9bbe1f5mr5159861fac.20.1732138447479; Wed, 20 Nov 2024 13:34:07 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:06 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:28 -0600 Subject: [PATCH 05/11] iio: dac: ad7293: use devm_regulator_get_enable_read_voltage() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-5-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Simplify the code by using devm_regulator_get_enable_read_voltage(). A small change in behavior here due to moving the enable to the same place as the get: supplies now are enabled before the reset GPIO is toggled (which is arguably the correct order). Signed-off-by: David Lechner --- drivers/iio/dac/ad7293.c | 66 ++++++++------------------------------------= ---- 1 file changed, 11 insertions(+), 55 deletions(-) diff --git a/drivers/iio/dac/ad7293.c b/drivers/iio/dac/ad7293.c index 1d4032670482..58f7926ec3f3 100644 --- a/drivers/iio/dac/ad7293.c +++ b/drivers/iio/dac/ad7293.c @@ -141,8 +141,6 @@ struct ad7293_state { /* Protect against concurrent accesses to the device, page selection and = data content */ struct mutex lock; struct gpio_desc *gpio_reset; - struct regulator *reg_avdd; - struct regulator *reg_vdrive; u8 page_select; u8 data[3] __aligned(IIO_DMA_MINALIGN); }; @@ -777,6 +775,7 @@ static int ad7293_reset(struct ad7293_state *st) static int ad7293_properties_parse(struct ad7293_state *st) { struct spi_device *spi =3D st->spi; + int ret; =20 st->gpio_reset =3D devm_gpiod_get_optional(&st->spi->dev, "reset", GPIOD_OUT_HIGH); @@ -784,24 +783,23 @@ static int ad7293_properties_parse(struct ad7293_stat= e *st) return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_reset), "failed to get the reset GPIO\n"); =20 - st->reg_avdd =3D devm_regulator_get(&spi->dev, "avdd"); - if (IS_ERR(st->reg_avdd)) - return dev_err_probe(&spi->dev, PTR_ERR(st->reg_avdd), + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "avdd"); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, "failed to get the AVDD voltage\n"); + if (ret > 5500000 || ret < 4500000) + return -EINVAL; =20 - st->reg_vdrive =3D devm_regulator_get(&spi->dev, "vdrive"); - if (IS_ERR(st->reg_vdrive)) - return dev_err_probe(&spi->dev, PTR_ERR(st->reg_vdrive), + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vdrive"); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, "failed to get the VDRIVE voltage\n"); + if (ret > 5500000 || ret < 1700000) + return -EINVAL; =20 return 0; } =20 -static void ad7293_reg_disable(void *data) -{ - regulator_disable(data); -} - static int ad7293_init(struct ad7293_state *st) { int ret; @@ -816,48 +814,6 @@ static int ad7293_init(struct ad7293_state *st) if (ret) return ret; =20 - ret =3D regulator_enable(st->reg_avdd); - if (ret) { - dev_err(&spi->dev, - "Failed to enable specified AVDD Voltage!\n"); - return ret; - } - - ret =3D devm_add_action_or_reset(&spi->dev, ad7293_reg_disable, - st->reg_avdd); - if (ret) - return ret; - - ret =3D regulator_enable(st->reg_vdrive); - if (ret) { - dev_err(&spi->dev, - "Failed to enable specified VDRIVE Voltage!\n"); - return ret; - } - - ret =3D devm_add_action_or_reset(&spi->dev, ad7293_reg_disable, - st->reg_vdrive); - if (ret) - return ret; - - ret =3D regulator_get_voltage(st->reg_avdd); - if (ret < 0) { - dev_err(&spi->dev, "Failed to read avdd regulator: %d\n", ret); - return ret; - } - - if (ret > 5500000 || ret < 4500000) - return -EINVAL; - - ret =3D regulator_get_voltage(st->reg_vdrive); - if (ret < 0) { - dev_err(&spi->dev, - "Failed to read vdrive regulator: %d\n", ret); - return ret; - } - if (ret > 5500000 || ret < 1700000) - return -EINVAL; - /* Check Chip ID */ ret =3D __ad7293_spi_read(st, AD7293_REG_DEVICE_ID, &chip_id); if (ret) --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26EB519CD1D for ; Wed, 20 Nov 2024 21:34:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138451; cv=none; b=kzTqj5LEgmrIOvdp5hOJ404RVB1Ka05Q/Ffy2epAOX66elWGW30IF/h/3EVdzADVEWTD+20EodceD/nBx0PJFtN5GpS3OF/LHdD8SmQWNZKSe7A8aCBFGEhyNsa4rcC7P9kf7nmNXtuxx8m86I5YKQbQ9ku6MqtgoX83rhvfM+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138451; c=relaxed/simple; bh=YjqOsVePl6JyW118q8DsTO1Va4k/YK8vLblJ92Fp8so=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a2Mo1d960PdxRMtZu+qSLfiD/gWo1N4jc0BIQvPxmSh4NKUjMcnUhCfIbZxU160h+mg1D4pz0gT8MGF3cmqQpVQ9oESMp3Bqvt9MBEKMhJT3y6+99FQZuEJnEYBqdGVVg+a0Ikks95CRO8eQW7OyYrwQHklQYU+PpBTuz63apZc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=tY2ER4G5; arc=none smtp.client-ip=209.85.160.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="tY2ER4G5" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-295eb32566dso199084fac.1 for ; Wed, 20 Nov 2024 13:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138449; x=1732743249; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uJZQBFRnmYxrzYBipVu7BSAWGgETcbwul8XNON+Nu4o=; b=tY2ER4G5jPp4QO7dmGYoQ/PgMz0O0dpnTAXeccYKEnkpZb8c4RT7YtYV2Xh4biQBaH +dYf3ywiKqK/SgXhew1Qch/6bwXXY9BvQs72FC/YThtMl1zaJd9Qi9/R+ShkcabricjS zCT9p6mIKfLXufm0zzMpWgP5BmoIRiTF5wd1rAiuuVv7wpb1keJ/ACw+MPzjUagBEKWr hQcHj/yoF2tZ4veFgjDv7M89vQUMn2PKGhELZwt/p/t6qeroMBjniooy0dIBWtAimfuL MgdGpyKgh6oK4jADrfQycdeDKsvDLJaMTeuBI6vvyzyN72CKO4Eh3hYkRcwJUc/5ZN2+ Yu3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138449; x=1732743249; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uJZQBFRnmYxrzYBipVu7BSAWGgETcbwul8XNON+Nu4o=; b=do21wfra0KYtQ0JeTSOqUNy9Us+T5GihXkFb2rAfn+ljMLed6Jcu6uKBGU1EImzGgT JlnaPoBLwjz6EkXOFzGKFIfPVd04HiX4QKY5ZksJ8qORYKfXhR+D1wy/IEAkPu2c+XM5 UIFxBDV1p1ZGCbjwdvGE3xfs7L0fmC5syIsgtTfJ8jzzdhbosvPYWZH7dbjbLQXWzBsb l3xxsf50w0WK8frSZJ0OsBekVcWQhMx+Xczj8MisjvcehQJ4CEYFK0/jmAAwtI859hw0 SB/tEyrw9z7As9o0ewNivThhIVZ7OwqpfQrgNlsiUWXm3rvPNBJX/ms5kLvvJPI7x1eJ xQHA== X-Forwarded-Encrypted: i=1; AJvYcCVuIaBGHvcOvacha4dvdHqkxyQ9CVYu6FPdgqRCGZKz3ln2tD4G1IPC3h3+kTs2ZEzIpYAPifP1ZNQKqO4=@vger.kernel.org X-Gm-Message-State: AOJu0YzXvMd5AjQVNnIQkQkQSIyDvMqiIm7gvZyqI5SZl7/WEblo3kH3 Z9F2VS+jlgoki3Fa8GBoeJbfqXB/pvihXcGFKqWbEAafyqKLPYyVw9XUBO6eWfo= X-Gm-Gg: ASbGnctgYga98+KbHfNwINQ1YNBB7Q9Uq+cgFlvccH4JuYbOexp1s1MmU60noiM+q+G Tzg+JhguJvJgAbNd8/3Xp0JIzElVybc/c7YY4HYc+30rNOv1isP89BmvjERswBfjrv6BfSL9B84 n4iOjaf+MIAH+7CT2kTwdAYKrOh3Fxcjai0t+ChI9lka5KMnpQdzTjrA+cEtIdBwibJrE7aiREd n7sG+Anxjgft4jMLOcsoo6g/hu8vYZcJTpNmA79GCIPUzi42mqPN5lC3e937Lh63fQApIeAJ00o AoxRsA== X-Google-Smtp-Source: AGHT+IGGWhizSMIHEU9PwpCFwQtddmQouUfb9G2QjGVXrzwtaGtElTxE36+XrkVbMrbkvPL2h1MFGA== X-Received: by 2002:a05:6871:8214:b0:289:2126:6826 with SMTP id 586e51a60fabf-296d9eb4983mr5002242fac.30.1732138449182; Wed, 20 Nov 2024 13:34:09 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:07 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:29 -0600 Subject: [PATCH 06/11] iio: dac: ad8801: use devm_regulator_get_enable_read_voltage() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-6-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Simplify the code by using devm_regulator_get_enable_read_voltage(). Signed-off-by: David Lechner --- drivers/iio/dac/ad8801.c | 70 +++++++++-----------------------------------= ---- 1 file changed, 12 insertions(+), 58 deletions(-) diff --git a/drivers/iio/dac/ad8801.c b/drivers/iio/dac/ad8801.c index 919e8c880697..bd857754fc11 100644 --- a/drivers/iio/dac/ad8801.c +++ b/drivers/iio/dac/ad8801.c @@ -23,8 +23,6 @@ struct ad8801_state { unsigned char dac_cache[8]; /* Value write on each channel */ unsigned int vrefh_mv; unsigned int vrefl_mv; - struct regulator *vrefh_reg; - struct regulator *vrefl_reg; =20 __be16 data __aligned(IIO_DMA_MINALIGN); }; @@ -122,51 +120,20 @@ static int ad8801_probe(struct spi_device *spi) state->spi =3D spi; id =3D spi_get_device_id(spi); =20 - state->vrefh_reg =3D devm_regulator_get(&spi->dev, "vrefh"); - if (IS_ERR(state->vrefh_reg)) - return dev_err_probe(&spi->dev, PTR_ERR(state->vrefh_reg), - "Vrefh regulator not specified\n"); + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vrefh"); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, + "failed to get Vrefh voltage\n"); =20 - ret =3D regulator_enable(state->vrefh_reg); - if (ret) { - dev_err(&spi->dev, "Failed to enable vrefh regulator: %d\n", - ret); - return ret; - } - - ret =3D regulator_get_voltage(state->vrefh_reg); - if (ret < 0) { - dev_err(&spi->dev, "Failed to read vrefh regulator: %d\n", - ret); - goto error_disable_vrefh_reg; - } state->vrefh_mv =3D ret / 1000; =20 if (id->driver_data =3D=3D ID_AD8803) { - state->vrefl_reg =3D devm_regulator_get(&spi->dev, "vrefl"); - if (IS_ERR(state->vrefl_reg)) { - ret =3D dev_err_probe(&spi->dev, PTR_ERR(state->vrefl_reg), - "Vrefl regulator not specified\n"); - goto error_disable_vrefh_reg; - } - - ret =3D regulator_enable(state->vrefl_reg); - if (ret) { - dev_err(&spi->dev, "Failed to enable vrefl regulator: %d\n", - ret); - goto error_disable_vrefh_reg; - } - - ret =3D regulator_get_voltage(state->vrefl_reg); - if (ret < 0) { - dev_err(&spi->dev, "Failed to read vrefl regulator: %d\n", - ret); - goto error_disable_vrefl_reg; - } + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vrefl"); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, + "failed to get Vrefl voltage\n"); + state->vrefl_mv =3D ret / 1000; - } else { - state->vrefl_mv =3D 0; - state->vrefl_reg =3D NULL; } =20 spi_set_drvdata(spi, indio_dev); @@ -177,31 +144,18 @@ static int ad8801_probe(struct spi_device *spi) indio_dev->name =3D id->name; =20 ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&spi->dev, "Failed to register iio device: %d\n", - ret); - goto error_disable_vrefl_reg; - } + if (ret) + return dev_err_probe(&spi->dev, ret, + "Failed to register iio device\n"); =20 return 0; - -error_disable_vrefl_reg: - if (state->vrefl_reg) - regulator_disable(state->vrefl_reg); -error_disable_vrefh_reg: - regulator_disable(state->vrefh_reg); - return ret; } =20 static void ad8801_remove(struct spi_device *spi) { struct iio_dev *indio_dev =3D spi_get_drvdata(spi); - struct ad8801_state *state =3D iio_priv(indio_dev); =20 iio_device_unregister(indio_dev); - if (state->vrefl_reg) - regulator_disable(state->vrefl_reg); - regulator_disable(state->vrefh_reg); } =20 static const struct spi_device_id ad8801_ids[] =3D { --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90FAF1C9DF7 for ; Wed, 20 Nov 2024 21:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138453; cv=none; b=fBAiVNKHIjl6DD6FwYj+bsGYNd5yP0QZNGjUjPQMvsSBym5dirEtT1vVfPx6qQl3We1mNkZFxq7xuE1A6hdCklv7veEeMQRZGoIT+SmOasiumBQ4u85fMU26+0uCMx4Ztgvinqj6iUhaaOlBrxqEUiw3UvGy1nxoDyKk027PcuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138453; c=relaxed/simple; bh=KPajQC1aALEfbneuHvtuGop3ovSJzfya4SbeCBcQxC4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jEWHJ1r+2QrzZlxkcu1ND41SofUNf/cF1eM9RnOosT4C3IAxcxhP/PuyN09LaPUS9OgdXBI+2piW7U2Dnmx7UO69aNrxQbnslyPQC3Qz/6JSoqIf/SHnsqcOR+Q8hz5ce1YXk076y23/GcUJvAxsA2Qyd1JDa9x40f8ZJXaaSig= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=evUxwzHM; arc=none smtp.client-ip=209.85.160.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="evUxwzHM" Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-2958ddf99a7so270169fac.2 for ; Wed, 20 Nov 2024 13:34:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138451; x=1732743251; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MOcVB06XaJFOi/s6psv+BsWaLcpfMNJDY6ZQUGIvfPw=; b=evUxwzHM37PcH3OZ+VRAL7LA11tobqW5GV7WawyP8IUEbHO7LGV3ZdpwpVyhlMvbNV xf60zvj0kB2wIWP8pVvxei9kE9ROpt0ih6HpvHWVqHGT959qp3M1TRszo4wEoQON9D5a 1Ehpz3MCWJ5dhlRerh7Cdv5yafKVQlE8fDm9Ejrac1v7XHlKMplysY5VXuEKHJwX34Ak 4hZBCyVoumari/S9I2m0/y51okrSof318rBcrblj2wd98vG4WVEWnDQAT/o4BQVMU7DY kKAd8U6W5MbZWf+lu5QQ+q1QpEsB11T9Jf2a6PjRTFkO4PN5ajWuNLoCaNyEndEYLCT0 5LhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138451; x=1732743251; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MOcVB06XaJFOi/s6psv+BsWaLcpfMNJDY6ZQUGIvfPw=; b=GFqzSa+E+5QQnG9jO6zBz0EGFArARx5FZy1idDm25bkk5HBi6ViGLFdInixFudkMKv bEsJbRB6cOzXxK2v1YDAewoN40csZkScYjpGNll85CpirJ+znpfmMni0qnyeq2k7QZI1 eOxCIku+QEyaRLFjEhXOUOqLHAaIF4tLvVzy7N6B+9O2+HtkFlqNSD7F5U6ZeOs/bDTL WUxXy1ZlktyIG+J+LhLLjvp1cI7xnCvq1RPve7vHkyzJOZqYuTw4x9nzers4Q5t8hRRv l9wQc9xZl/jwop+W5V5LeV5tvk88mEQeLGCH3FO+TfA5HmQvlmHaHKTk9DYZbGQj46kU DfOw== X-Forwarded-Encrypted: i=1; AJvYcCVMJIuLu4ZscW5DKijlY6qoFn/sZZ/+tUSfoYSU4CvI3R8xmUpZpN++Ql2WGWAFEay9xnuKYsCxIDT2DN4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxi3XZQvv1OLXGEc1NdTClio5qkGfqiOSABZpWkVuXXrkQu2xaZ +EKWb1gkropEhQGncT2Nuvm5Knc7PnAiXhtBnb41fJq/C9V9VUOZi40p6QAfiJs= X-Gm-Gg: ASbGncsr853sxf6LjDpEOHMch/n0LV6uKFm6Sq2yszwB/Bep698GyM6ZBF5nEC9Y94q idYyCMPTGu0usqmcH6EAhiDa6gArnhQK9XAufIcSePndw+reVX5l2RWEUvrs3TTVkSHP8U78OBE vTJ/G86I0LYwIfqYxAAuuVm52TcTem/E/142Z7v0ajAut9KC7K4iuYxipbm/gzFoIOIaHF9s3LN Wwa+LFvuWNi9ns3UN66JrnK5xK9CSde90NZQMDj+mTjdrZrU1zSCt68v5HfzP3j2K1BGDS4Dwxa m6GNUg== X-Google-Smtp-Source: AGHT+IGZjpgvy1HtxraukJAx9aw7qrY82YEtPjjvc0y70FfHyFvmqDxdPRVkajBg6fK1WC3NQZuHSA== X-Received: by 2002:a05:6870:ad05:b0:296:9c08:51a3 with SMTP id 586e51a60fabf-296d9f50b0bmr4358153fac.39.1732138450920; Wed, 20 Nov 2024 13:34:10 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:09 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:30 -0600 Subject: [PATCH 07/11] iio: dac ad8801: drop driver remove function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-7-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Remove driver remove callback in the ad8801 driver. By making use of devm_iio_device_register(), we no longer need a driver remove callback. Also since this was the last user of spi_get_drvdata(), we can drop the call to spi_set_drvdata(). Signed-off-by: David Lechner --- drivers/iio/dac/ad8801.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/iio/dac/ad8801.c b/drivers/iio/dac/ad8801.c index bd857754fc11..8a362fae2eca 100644 --- a/drivers/iio/dac/ad8801.c +++ b/drivers/iio/dac/ad8801.c @@ -136,14 +136,13 @@ static int ad8801_probe(struct spi_device *spi) state->vrefl_mv =3D ret / 1000; } =20 - spi_set_drvdata(spi, indio_dev); indio_dev->info =3D &ad8801_info; indio_dev->modes =3D INDIO_DIRECT_MODE; indio_dev->channels =3D ad8801_channels; indio_dev->num_channels =3D ARRAY_SIZE(ad8801_channels); indio_dev->name =3D id->name; =20 - ret =3D iio_device_register(indio_dev); + ret =3D devm_iio_device_register(&spi->dev, indio_dev); if (ret) return dev_err_probe(&spi->dev, ret, "Failed to register iio device\n"); @@ -151,13 +150,6 @@ static int ad8801_probe(struct spi_device *spi) return 0; } =20 -static void ad8801_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev =3D spi_get_drvdata(spi); - - iio_device_unregister(indio_dev); -} - static const struct spi_device_id ad8801_ids[] =3D { {"ad8801", ID_AD8801}, {"ad8803", ID_AD8803}, @@ -170,7 +162,6 @@ static struct spi_driver ad8801_driver =3D { .name =3D "ad8801", }, .probe =3D ad8801_probe, - .remove =3D ad8801_remove, .id_table =3D ad8801_ids, }; module_spi_driver(ad8801_driver); --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D5091CACDB for ; Wed, 20 Nov 2024 21:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138456; cv=none; b=fD98bQGOsZyr60Ve3helKifCzfLfIdBMg4y8d1aCshbdD+PCBJbcZwoDwTN27DzTdEyMr+e2nXhatXOEyRy15abTynIZuZXYh7Ga8I2VtR3df8urupXrS3nBP8RWQlEOy+BcG/XlGd6PiZqhqwHcJjV/HWs9giQjltUXdsjhG3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138456; c=relaxed/simple; bh=cqpjVH/ZHG/gtX5vBp7R7T9+N9m5GCO0J0pDNO2Q4Kc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TsVRdemCyjtBgEuyHtqqAQ84AyHZfcL4ghCAkZf+wuhidTjIbikxLVykiy3KDQyrNaMkznfYMsNbwdiFkZWnC9pySm5656ePu2EMBAa9q6s4AiUhkPXQ9C+wNCXBIGlyN3KuVjO10DJLYb9+MeNTYyOD9G3ilPb+SXFX9Oz7EBo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=S7GJH91g; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="S7GJH91g" Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-294ec8e1d8aso285612fac.1 for ; Wed, 20 Nov 2024 13:34:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138452; x=1732743252; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MEOSnirGLwe2cYoSNYVfb2qy88ppTs6R6KUAO1rKhdk=; b=S7GJH91gJmrpCWxFbekapCN3KauKDd6M5kC3f/Cr42LxAlz6ya7GKhll4OYuvrMaAm 7muDJLFEDp6vFgBDQGUu8hs5G+Qydrze/U0dc1TksKycDFI2iQ4hB0nMQGYJ6GZL6Vyo C+Fkvp6GpIZdS8hqn696xnVHkd6ov9uDb1z5gk+WWZSPglzg2Wb//utFytLs+91nMnF4 UqtHYG+smUjeNHuz918Fs3zstLm8vTUJ0zj9ctv3gTTpT5XdsAyYdLImlozfVXRK2G/6 FLbCNb6cQ88yNv3V71lItfo+QC2HOcZD8oCR2poDpQDbubrotnF/sg2+Jui9H43bH4mw A/Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138452; x=1732743252; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MEOSnirGLwe2cYoSNYVfb2qy88ppTs6R6KUAO1rKhdk=; b=dED3PQkdqE0wQ57uWK08KRYzGrnEXDI8xjzUf3gOlR7+yvkw8bfuCyJbNrrbt72q/d dLPbA2l6L6gNDDr8rBXdAHu2/I+OX+fn8Yxp77eLRj/h9zyfaS+jh2rh1aegbnYI5who V2+hFatSJZTb2x/kt/KJWqYYxFTQtXjtW43QH1tvcD9L7aEDfe4rO6Y8rZ/CTIz62S8H LBMhEs3aKRSn95d4Zma9ZJ9lw9U3/aFrhyOiHrjRqvpcF0svqqhB2RJ2PxN/QoIRZOff 5wWbTyEDXUQM4jc8KQFMFwVHGsvi14R7fkN6KMaXkicoBLTlPX649/if2qfMMeMyranT Aoxw== X-Forwarded-Encrypted: i=1; AJvYcCVqEKdQiYrQG/vYs8BUmidwNCM0Fq8HGEM2WkESj82jWsDK/hVBI5EJ71lip6IQGTfCEOf8u9yXVrk/iwo=@vger.kernel.org X-Gm-Message-State: AOJu0YxVr5sQmrD70c4B+NmxNFEBjYwIl8hp9VMP2bhOwl37yUY4mLtg p46/o+YX6tGpQVAFLTIkfmzA8DNAyfhvjK7Ap/0m6GdK+l+QXW/2bWEHDOBQp94= X-Google-Smtp-Source: AGHT+IE3dNYFl8/w+vB/dPnniS0LPl8Cv8wHc2xOQWuQL26dH5rgdnki/dDN7dDXrEFszIQdl+kJPA== X-Received: by 2002:a05:6870:c384:b0:296:de10:4ef with SMTP id 586e51a60fabf-296de10524cmr3093227fac.0.1732138452571; Wed, 20 Nov 2024 13:34:12 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:12 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:31 -0600 Subject: [PATCH 08/11] iio: dac: ltc2632: use devm_regulator_get_enable_read_voltage() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-8-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Simplify the code by using devm_regulator_get_enable_read_voltage(). Some use of dev_err() is replaced with dev_err_probe() to simplify things even more since we are refactoring these lines anyway. Signed-off-by: David Lechner --- drivers/iio/dac/ltc2632.c | 58 +++++++++++++++----------------------------= ---- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/drivers/iio/dac/ltc2632.c b/drivers/iio/dac/ltc2632.c index a4fb2509c950..28f8347eb687 100644 --- a/drivers/iio/dac/ltc2632.c +++ b/drivers/iio/dac/ltc2632.c @@ -41,13 +41,11 @@ struct ltc2632_chip_info { * @spi_dev: pointer to the spi_device struct * @powerdown_cache_mask: used to show current channel powerdown state * @vref_mv: used reference voltage (internal or external) - * @vref_reg: regulator for the reference voltage */ struct ltc2632_state { struct spi_device *spi_dev; unsigned int powerdown_cache_mask; int vref_mv; - struct regulator *vref_reg; }; =20 enum ltc2632_supported_device_ids { @@ -310,6 +308,7 @@ static int ltc2632_probe(struct spi_device *spi) struct ltc2632_state *st; struct iio_dev *indio_dev; struct ltc2632_chip_info *chip_info; + bool has_external_vref; int ret; =20 indio_dev =3D devm_iio_device_alloc(&spi->dev, sizeof(*st)); @@ -324,43 +323,26 @@ static int ltc2632_probe(struct spi_device *spi) chip_info =3D (struct ltc2632_chip_info *) spi_get_device_id(spi)->driver_data; =20 - st->vref_reg =3D devm_regulator_get_optional(&spi->dev, "vref"); - if (PTR_ERR(st->vref_reg) =3D=3D -ENODEV) { - /* use internal reference voltage */ - st->vref_reg =3D NULL; - st->vref_mv =3D chip_info->vref_mv; + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vref"); + if (ret < 0 && ret !=3D -ENODEV) + return dev_err_probe(&spi->dev, ret, + "Failed to get vref regulator voltage\n"); =20 - ret =3D ltc2632_spi_write(spi, LTC2632_CMD_INTERNAL_REFER, - 0, 0, 0); - if (ret) { - dev_err(&spi->dev, - "Set internal reference command failed, %d\n", - ret); - return ret; - } - } else if (IS_ERR(st->vref_reg)) { - dev_err(&spi->dev, - "Error getting voltage reference regulator\n"); - return PTR_ERR(st->vref_reg); - } else { - /* use external reference voltage */ - ret =3D regulator_enable(st->vref_reg); - if (ret) { - dev_err(&spi->dev, - "enable reference regulator failed, %d\n", - ret); - return ret; - } - st->vref_mv =3D regulator_get_voltage(st->vref_reg) / 1000; + has_external_vref =3D ret !=3D -ENODEV; + st->vref_mv =3D has_external_vref ? ret / 1000 : chip_info->vref_mv; =20 + if (has_external_vref) { ret =3D ltc2632_spi_write(spi, LTC2632_CMD_EXTERNAL_REFER, - 0, 0, 0); - if (ret) { - dev_err(&spi->dev, - "Set external reference command failed, %d\n", - ret); - return ret; - } + 0, 0, 0); + if (ret) + return dev_err_probe(&spi->dev, ret, + "Set external reference command failed\n"); + } else { + ret =3D ltc2632_spi_write(spi, LTC2632_CMD_INTERNAL_REFER, + 0, 0, 0); + if (ret) + return dev_err_probe(&spi->dev, ret, + "Set internal reference command failed\n"); } =20 indio_dev->name =3D fwnode_get_name(dev_fwnode(&spi->dev)) ?: spi_get_dev= ice_id(spi)->name; @@ -375,12 +357,8 @@ static int ltc2632_probe(struct spi_device *spi) static void ltc2632_remove(struct spi_device *spi) { struct iio_dev *indio_dev =3D spi_get_drvdata(spi); - struct ltc2632_state *st =3D iio_priv(indio_dev); =20 iio_device_unregister(indio_dev); - - if (st->vref_reg) - regulator_disable(st->vref_reg); } =20 static const struct spi_device_id ltc2632_id[] =3D { --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 051D81CB315 for ; Wed, 20 Nov 2024 21:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138456; cv=none; b=QWRS4hGeruH+50uhF2ZIhZ88lzkAa/tTltwAgwP0ULj3CnoOJfXB10T8Ys2AWL1ym3yHCg1C7CCTrZaDGZV7YbtZedat6g8KysME3kE0hTijn8WIWX99KsyKiYay1PqymOQmTgr5w7LSRgiGI/ScGXvxRLc0WtOCMzWji6UZw08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138456; c=relaxed/simple; bh=CyydzNDsDkr/quaSIfIhVHyKeXWWtMquRLckOhQ1Ays=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bgOkfSp4zN7EXoTYMJeRJAPKpVeVVBbMIAwRvl4HwdbgouLFv7Cg5vp5ZPMd4S4pb7lRPUWOHcq6VQ8ygyTYDn7vCw4j2fbO+qUDAo5DmHrP5HtcU2GWj2YNZD0BB9GvwQ38wjS1SPssG2j5wMiMyodNHqkgs4sdAk04SD8cJco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=3IPc9pwH; arc=none smtp.client-ip=209.85.160.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="3IPc9pwH" Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-2968322f5feso213220fac.0 for ; Wed, 20 Nov 2024 13:34:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138454; x=1732743254; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=77ie5w/VsDTXsB3Zb7StqnidCTZr0gF72TiY+5MfJgI=; b=3IPc9pwHG55nd29+1Rwi0wUX7A6UCLeUTEiPxdnFAsyS+ElPD7bNPKPzATc0w1wx1P QKGXYPMDkaODHGr2a+84eya9boaM5H3a6CXvg0SzO5el9uXDzGP/F+kTgzln7NTTiDrB /yQb80nPioT+VPSokUqYrkGTJ2ccYxQR4c6vhY4B7mKHuln+tmWm/sMYuZDpiJZ/uBQd TxcAH+3PlZqDpWRv6Q549KJ8nQQ5Stw6sxoc4xuNIXLWYDbFRDEkaOR38aRGvZEwQJbd GXw6mDCYdHDc3n+XF1gv0EmMi6iHMLtonJe+1xWyw9mw2BhLM4w78V4tRqc844UBie+e G1fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138454; x=1732743254; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=77ie5w/VsDTXsB3Zb7StqnidCTZr0gF72TiY+5MfJgI=; b=ilefcvFgKkMs/tbCm5tagszwcC+ew7e+VUgx5rCUdhgyS+LHLMnPK3xOFRH7rM8+bK dhWORf1ntXeXG575GRWlhKTauZ4ouzIxdhRyhkZAURSqM2B4Z8BNEtRHki/A39eOtV/s 1mBos6Rtpb054tEqzaCaGXsLLRd9wJPBsa90TF4sHTgEtssht/xtXmWTG0awdFtle7Aq eweCl0xxLAAKzdqZpByhc77FcMpiABNKeF6OLC3qisRrISRPn0KFnZMi/GNSRgnPnBF2 0F+d8JeD3eln1LQdqlyNnBjgAvaDcCEkikozcdyy9lqNgpyPhyH6lg9ARtzZ9VKh0BBX 7uDA== X-Forwarded-Encrypted: i=1; AJvYcCXNCyC8uwI299I/seMWVvzavTQGf1KZ0QJyzAX2YtQF7uWCBXOoVH3PdDqqDLymqYgFwxrmyvc88ptWw8Y=@vger.kernel.org X-Gm-Message-State: AOJu0YzBS3gR5BTTzorsl/fJQGZKfO6viwpLAeOeDtMeZrFA4C9zGhla U35dLbxCKjVBnP678/L+nJk8RJjVvnX28uJITZmJKl/Wn+kEuzva8cDNqSLklSo= X-Google-Smtp-Source: AGHT+IHfg51H/POGhX0HCvnX9lVYP+vG5yg84xlJ+/GItJcQcBHCoqSwnUiOnoiXmiJD2aLS8Sy3Mg== X-Received: by 2002:a05:6871:4393:b0:296:b11b:a615 with SMTP id 586e51a60fabf-296d9e72b3cmr4816484fac.37.1732138454302; Wed, 20 Nov 2024 13:34:14 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:14 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:32 -0600 Subject: [PATCH 09/11] iio: dac ltc2632: drop driver remove function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-9-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Remove driver remove callback for the ltc2632 driver. By making use of devm_iio_device_register(), we no longer need a driver remove callback. Also since this was the last user of spi_get_drvdata(), we can drop the call to spi_set_drvdata(). Signed-off-by: David Lechner --- drivers/iio/dac/ltc2632.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/iio/dac/ltc2632.c b/drivers/iio/dac/ltc2632.c index 28f8347eb687..999348836d87 100644 --- a/drivers/iio/dac/ltc2632.c +++ b/drivers/iio/dac/ltc2632.c @@ -317,7 +317,6 @@ static int ltc2632_probe(struct spi_device *spi) =20 st =3D iio_priv(indio_dev); =20 - spi_set_drvdata(spi, indio_dev); st->spi_dev =3D spi; =20 chip_info =3D (struct ltc2632_chip_info *) @@ -351,14 +350,7 @@ static int ltc2632_probe(struct spi_device *spi) indio_dev->channels =3D chip_info->channels; indio_dev->num_channels =3D chip_info->num_channels; =20 - return iio_device_register(indio_dev); -} - -static void ltc2632_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev =3D spi_get_drvdata(spi); - - iio_device_unregister(indio_dev); + return devm_iio_device_register(&spi->dev, indio_dev); } =20 static const struct spi_device_id ltc2632_id[] =3D { @@ -450,7 +442,6 @@ static struct spi_driver ltc2632_driver =3D { .of_match_table =3D ltc2632_of_match, }, .probe =3D ltc2632_probe, - .remove =3D ltc2632_remove, .id_table =3D ltc2632_id, }; module_spi_driver(ltc2632_driver); --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D05251BD513 for ; Wed, 20 Nov 2024 21:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138457; cv=none; b=Prw1FPC7hEC/K5u/+BEo+N1ZVvYdLLvn4P5DM9/o/Il6KuhXEnfKTPNnPGxATc/cv+fXXuxNwHQCq7ee7JfH6m8nqc/+nt2171S2MLz4GC63q+Z4vy/+/0DsdlK02aiABUvB3DCzbmimEDEvHak0CmC7TGaqrafj66C9xo4+FM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138457; c=relaxed/simple; bh=p+nS5eNSFSea7wrSjxxVMVpqrYPjYIH7CARSb8ahoso=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YLqLkPMie3ZgwmDTJF4y7zuOncfDpP97zie6pHK38F8CPWlnFcKn2/OcvDlEE0n7UwmX9Lkdqy8m5OLgC4w3NJflTk2MLCCTNrX0EnGLE8ZaSuCQyRz3r+EHbLDySUBEuD8/L82iY9s2Wl1Qrh9TEYBPN2CPwADsx5WAzBNqUnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=eWdCakaS; arc=none smtp.client-ip=209.85.160.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="eWdCakaS" Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-27b7a1480bdso192587fac.2 for ; Wed, 20 Nov 2024 13:34:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138455; x=1732743255; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Iu7aDJGbDBdHDN9nX/nWmhMIbwEvqk3RBRXOi7f/0Bs=; b=eWdCakaS1yWEa5IIT34PgY74OenRfeKe7SngSBN+gJZGVnplvScAZ/YtU2GcygfrP7 75AitbXoNAEZ7mgrzy9+XuQDoocSLYs6s8wWEmIWAIrLGfcw62x9ylZTvZJ4Vgx/5ATz TSH7a6DG9SgNnIIL0za2EbIZmt0wVNdis6zTGz1fqPzYETcDjAGyRKLrl0RwnTrl1YOl dNBoDqZFemnek89qCiEsDRje/kWKcK5ERg+7xDLkq1++7IA96AnBlitDJk+Lgaz2/Tw+ TL+VudG+xWeI64sOouOyv5ff7cFxBHyLg1tBX/tg28qAodkgzI7djI2+z4PnDRT+MU7y 7GZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138455; x=1732743255; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iu7aDJGbDBdHDN9nX/nWmhMIbwEvqk3RBRXOi7f/0Bs=; b=u65eZjPOUFJdpsJj/9ZOqNUrP6EJSMelDyQcNT+DKQXh+hsX+MOlxV8/1ICDpdA0OD 1IIFY5eRbYZtS403f95TrWJLWZgk7+sZjfgy/A9jMzDUEONFkKMEomhD+ZKkwWKHi3gE kNh6VtOjSU1LZ1dlUff/fz7ciZrdRqF2YLHaMZSuq29sMqN1wJhj9EYDfVz61oJpZuKK HBQvt/MlS5w+ZAfSnNM/hTIBtOGh8oSsfKec+hPj643odwBLpV05ZZy/6p4XSccfn76Y qFqRbJgU0/ZJ4ML9XT9yU2EupV+xDJfQsoiK8T9GTdRLg8qjUD3xKMzaVVfk4FpAECUC jsFw== X-Forwarded-Encrypted: i=1; AJvYcCXP4EnkdnxDyVr8BKDbtqGT129rihQoZrkZcFT/IbcC2Qp7ut9leYlfqkRdYhv/AdPad6wmMS8a7lGJ+Ps=@vger.kernel.org X-Gm-Message-State: AOJu0Yz97JY5thFFcitjjLyiehlYOH+NOfkoZE1H1T2Y6xhloMtSgefG u+KSeOjyznjus8gZxUdl5wnpi4zI+RGLxmgfAdjGzQM6z9K39ziBZnfEps7ltdA= X-Google-Smtp-Source: AGHT+IHXx6o3MNspetZNr4gTo1mEHeioI28P55Eo6Nd/3JODlVCwxdabASABo8ThWmfyi+yvZviiTw== X-Received: by 2002:a05:6871:4b12:b0:295:d711:f12d with SMTP id 586e51a60fabf-296d9ae33ecmr3788154fac.15.1732138455002; Wed, 20 Nov 2024 13:34:15 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:14 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:33 -0600 Subject: [PATCH 10/11] iio: dac: ltc2688: use devm_regulator_get_enable_read_voltage() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-10-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Simplify the code by using devm_regulator_get_enable_read_voltage(). Signed-off-by: David Lechner --- drivers/iio/dac/ltc2688.c | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/drivers/iio/dac/ltc2688.c b/drivers/iio/dac/ltc2688.c index 376dca163c91..bdc857c7fa6d 100644 --- a/drivers/iio/dac/ltc2688.c +++ b/drivers/iio/dac/ltc2688.c @@ -842,7 +842,7 @@ static int ltc2688_channel_config(struct ltc2688_state = *st) return 0; } =20 -static int ltc2688_setup(struct ltc2688_state *st, struct regulator *vref) +static int ltc2688_setup(struct ltc2688_state *st, bool has_external_vref) { struct device *dev =3D &st->spi->dev; struct gpio_desc *gpio; @@ -881,18 +881,13 @@ static int ltc2688_setup(struct ltc2688_state *st, st= ruct regulator *vref) if (ret) return ret; =20 - if (!vref) + if (!has_external_vref) return 0; =20 return regmap_set_bits(st->regmap, LTC2688_CMD_CONFIG, LTC2688_CONFIG_EXT_REF); } =20 -static void ltc2688_disable_regulator(void *regulator) -{ - regulator_disable(regulator); -} - static bool ltc2688_reg_readable(struct device *dev, unsigned int reg) { switch (reg) { @@ -947,8 +942,8 @@ static int ltc2688_probe(struct spi_device *spi) static const char * const regulators[] =3D { "vcc", "iovcc" }; struct ltc2688_state *st; struct iio_dev *indio_dev; - struct regulator *vref_reg; struct device *dev =3D &spi->dev; + bool has_external_vref; int ret; =20 indio_dev =3D devm_iio_device_alloc(dev, sizeof(*st)); @@ -973,34 +968,15 @@ static int ltc2688_probe(struct spi_device *spi) if (ret) return dev_err_probe(dev, ret, "Failed to enable regulators\n"); =20 - vref_reg =3D devm_regulator_get_optional(dev, "vref"); - if (IS_ERR(vref_reg)) { - if (PTR_ERR(vref_reg) !=3D -ENODEV) - return dev_err_probe(dev, PTR_ERR(vref_reg), - "Failed to get vref regulator"); - - vref_reg =3D NULL; - /* internal reference */ - st->vref =3D 4096; - } else { - ret =3D regulator_enable(vref_reg); - if (ret) - return dev_err_probe(dev, ret, - "Failed to enable vref regulators\n"); - - ret =3D devm_add_action_or_reset(dev, ltc2688_disable_regulator, - vref_reg); - if (ret) - return ret; - - ret =3D regulator_get_voltage(vref_reg); - if (ret < 0) - return dev_err_probe(dev, ret, "Failed to get vref\n"); + ret =3D devm_regulator_get_enable_read_voltage(dev, "vref"); + if (ret < 0 && ret !=3D -ENODEV) + return dev_err_probe(dev, ret, + "Failed to get vref regulator voltage\n"); =20 - st->vref =3D ret / 1000; - } + has_external_vref =3D ret !=3D -ENODEV; + st->vref =3D has_external_vref ? ret / 1000 : 0; =20 - ret =3D ltc2688_setup(st, vref_reg); + ret =3D ltc2688_setup(st, has_external_vref); if (ret) return ret; =20 --=20 2.43.0 From nobody Wed Jan 29 19:52:35 2025 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B43151CB333 for ; Wed, 20 Nov 2024 21:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138458; cv=none; b=bD69cMUWTWb+ZJG7+SIGI2GQi9MSjSD9omAkUJHlcqclfVTswKtcsW3LLAZDNBt0pGf6cfRLm5QepaGsimb/ufJH+KNuYlbGnVC9LB2gOyZBVwJdLHTfxDhFhyl3+eIbOG3y2+5Rcoyh3DQOJ8jOIRnMADSbZYTC+mDOyTaWR8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138458; c=relaxed/simple; bh=/Whh0lLO/yI7/FPmO+jIOLQNQF0tPIusHK4fVYMh/RY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=own42kXWgi3YAhHmi+zA5HPFbm9Y1ZDKVjsdThrM3mdpcD+PABcNRovbySSd01M6Rlf15SFVnZRJtGXw/9m0fhybgprZwVXI018T0WZiBbB4EAsD349Oy15sO6qaCx5CtgOGL44LRbsAnOZZfdX6hYhlfjpb4PhGwB5fEiRaMuU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=dHuSg9Tq; arc=none smtp.client-ip=209.85.161.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="dHuSg9Tq" Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5ec1ee25504so137906eaf.3 for ; Wed, 20 Nov 2024 13:34:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732138456; x=1732743256; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cxS2Z0C5wIvgTQSNU8Qu3dmatgrBAAmj1e5pgYj3js0=; b=dHuSg9TqOdo09fewDAsy7NY8cehS9cgCTVdERzvUHYqGr85ZyTQ1evMmMz2w63X08d mlgUK7wNno9VXsLTRsY6RRviD/rqv541w26z66X5bPM+sqi9YahxkoY3OgPiXbd/29VB +K3MlHv75BKuQG6RtcqYBLTF5CrkD1RTCnIIjkF/JMuEomkZ903j3PHeoS9/4IqsS+6I jKgL/TqO41iXr4RZnMI/qN29L8QM4+bOBJrHk0M2TIQGc7hKY06sDstWA+4M8FTqPyrt 9aihtzA5qGot4OvcK1bpXGPF9MuzxJgAx2hYp/5j/I5bypyQMG0BbyEJgSueCy3baWrc D/dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732138456; x=1732743256; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cxS2Z0C5wIvgTQSNU8Qu3dmatgrBAAmj1e5pgYj3js0=; b=pFAkfcljANGMWBTzWOR9Z4VDnQac9pyPOYg2/0FygLMQ8A0w+jFrZ7wcQNSn0jsvRg p4/uDPVzHI63JgFpOWBue1BE+g3e0BixRjiD6qKVzPNhLqRIZ6/vKwyjShoVYsngVevm 0OKwIYXnMfnEZ3RQBpTlSb8JJblWIzjoGJur1H9y/tCBCJ7w61yWoKbKxmZSQsASejRp K9L5hRitkSZ5i1hal4Ecp9ibNvLeqI4+eWaOGC9rk7TMPjKRua32m66LErQlsvK0a2el N5mcYR1pX7NOym/7PeHau/Tta5SXyOPNjMXfaaADb9xQvPGxUaUY60XK4E9Rp2Rqa9g3 Yoxw== X-Forwarded-Encrypted: i=1; AJvYcCWzFNuJ3ET1jTRVc75zfMmMid0rTCzQn+m8O8+f5ELv0PZx52S+T/6cCv+yHd/74ynsOX+9q5cqBhlXcik=@vger.kernel.org X-Gm-Message-State: AOJu0YzmqLVqEZn/IbzsvEEfaw5uIdolNuywWWuOcHri865kFN2GblVf WsDrJ2Euoi5aUYlvhQ3mrD1nyO8B1KkaBIjZm7eq2IN8bwaqXNwJVLYLKSMNBEQ= X-Google-Smtp-Source: AGHT+IF2lB8QgTcV4vegaXvpiMgWjD/98kXniLRx2lPUYn1xYr2NIjkpvUWFO1Od3RLDELoRjuQ/NA== X-Received: by 2002:a05:6870:ac85:b0:296:e46b:8d09 with SMTP id 586e51a60fabf-296e46bd876mr3947193fac.12.1732138455757; Wed, 20 Nov 2024 13:34:15 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29651852c27sm4487365fac.2.2024.11.20.13.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 13:34:15 -0800 (PST) From: David Lechner Date: Wed, 20 Nov 2024 15:33:34 -0600 Subject: [PATCH 11/11] iio: dac: max5821: use devm_regulator_get_enable_read_voltage() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241120-iio-regulator-cleanup-round-6-v1-11-d5a5360f7ec3@baylibre.com> References: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> In-Reply-To: <20241120-iio-regulator-cleanup-round-6-v1-0-d5a5360f7ec3@baylibre.com> To: Jonathan Cameron Cc: Michael Hennerich , Liam Girdwood , Mark Brown , Antoniu Miclaus , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.1 Simplify the code by using devm_regulator_get_enable_read_voltage(). Signed-off-by: David Lechner --- drivers/iio/dac/max5821.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c index 18ba3eaaad75..b062a18be5e7 100644 --- a/drivers/iio/dac/max5821.c +++ b/drivers/iio/dac/max5821.c @@ -32,7 +32,6 @@ enum max5821_device_ids { =20 struct max5821_data { struct i2c_client *client; - struct regulator *vref_reg; unsigned short vref_mv; bool powerdown[MAX5821_MAX_DAC_CHANNELS]; u8 powerdown_mode[MAX5821_MAX_DAC_CHANNELS]; @@ -295,11 +294,6 @@ static const struct iio_info max5821_info =3D { .write_raw =3D max5821_write_raw, }; =20 -static void max5821_regulator_disable(void *reg) -{ - regulator_disable(reg); -} - static int max5821_probe(struct i2c_client *client) { const struct i2c_device_id *id =3D i2c_client_get_device_id(client); @@ -321,32 +315,10 @@ static int max5821_probe(struct i2c_client *client) data->powerdown_mode[tmp] =3D MAX5821_100KOHM_TO_GND; } =20 - data->vref_reg =3D devm_regulator_get(&client->dev, "vref"); - if (IS_ERR(data->vref_reg)) - return dev_err_probe(&client->dev, PTR_ERR(data->vref_reg), - "Failed to get vref regulator\n"); - - ret =3D regulator_enable(data->vref_reg); - if (ret) { - dev_err(&client->dev, - "Failed to enable vref regulator: %d\n", ret); - return ret; - } - - ret =3D devm_add_action_or_reset(&client->dev, max5821_regulator_disable, - data->vref_reg); - if (ret) { - dev_err(&client->dev, - "Failed to add action to managed regulator: %d\n", ret); - return ret; - } - - ret =3D regulator_get_voltage(data->vref_reg); - if (ret < 0) { - dev_err(&client->dev, - "Failed to get voltage on regulator: %d\n", ret); - return ret; - } + ret =3D devm_regulator_get_enable_read_voltage(&client->dev, "vref"); + if (ret) + return dev_err_probe(&client->dev, ret, + "Failed to get vref regulator voltage\n"); =20 data->vref_mv =3D ret / 1000; =20 --=20 2.43.0