From patchwork Wed Nov 20 21:33:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881455 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 957471865E5 for ; Wed, 20 Nov 2024 21:34:02 +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=1732138445; cv=none; b=MEGJ3+WDtjGwkY950hbRo4pyD/DC7zbDDZVbITQ8PTpoaSBXzVoszSv5hDRDkFhDOX7aeqMyyiqaoRYeCeFH+RmL9JAWcuxE98Vj3EfL9cqifGovQdCkH1MW6XmZolDsLZKgSIlVCT72psrNrvFPmJENO8BeJIYWuG67ouhD3Vs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138445; c=relaxed/simple; bh=Xl1ucGBXN8Ab5O0eTwCrzfVk4oVpsNxeeYYkgyTO4wY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iPCZNEKj0TM2urLpUgFvY4P1wl59giTZ4bnqMaqNB/S+vqRg/qEVzKZjKTiUPtk+JNueAjNDXU/mw9u6VUvp7E31VstYvwS1eN06m2fqA96coplbu3nHJd6Z6IMy++sl83k0itslkcFpBeCoZ+mHjx7+ofnW2gjF8pym4ipys1U= 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.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="wuriinmc" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-29666708da7so214594fac.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=JWQrUIjlFrsw942ZDYRybc28atAGS6rDfu3470TOOS4MBgq8ZgDkR8l1B9cbPRCM+O xEljvQyT1l6MM3Bp7NopXHh26IXWNUnTp4eFwD2U45jDtDktPb+jGU7y+5+pJ6US0bZe RDFSeGnLdL0YC7LYNN4CXlhGJ16fZEiq7dc4LKPNVX1pzhTAbZtUqniQusWld8+IyHFg rJRyerQamnrYx3lYhOOCOgBu8XezgEoYEB3wxu7+5DWlJFK5CjGf3o18TqUviOYWMBnH yh6OuhAHOWftTFZXtfZKs1vGdQED/EytRU04Tk7+Vp/XGJBVcprsCuiFGUVgi2KzMq+i EWIw== X-Forwarded-Encrypted: i=1; AJvYcCXT20tDBvFSNGfD3+G4LHMkg9Po1adbWkIEhh5loaFgJCs5jvT9ovuPsVRlcrDGJp+1rGKvy4R9zww=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9kOd5lD5+h3Zm5++jnl2JkX/1eN7v0rYgFHni9C27OhIGTeOy AxfVklrjMJYQf4GsWoQxPA3w31S8YAw8wUGpgAYRiyWAdCHYjsw08D8kcfpLlgU= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 { }; /** - * 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 From patchwork Wed Nov 20 21:33:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881456 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (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 1CA6C1C4A0F for ; Wed, 20 Nov 2024 21:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138446; cv=none; b=m286iWs0Yf9lbQvDvf67mtFTRJMfUeDDx/RPtjWludPY6TJB4zV+UpfxNo5VauaBGg7VXp1bISMJiF1evYFz24uu6QVDUQVPpGIo8ehBkQEPQ1yqYnmiDFxQNz7yNEXFNZx3YeartDlfXRh95MAEXq0Uyzl3xrTMNlUUH+Ftqls= 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.50 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-f50.google.com with SMTP id 586e51a60fabf-2964645d2b7so219920fac.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=bNJhAYpbsEeKc5CtysvGD4Upt7/5yDOSDhhAmnuZh6kKRa8SoODZRucg8uXkLRniPv Nagmy3qS+uJLhJ3aLdWeR9jfYuvgLYEhDOXN6CSNco5aiHHeb2HkrISdT4ve1RMWkoxF oQnJ/y6A0jorTnYkWVK1d3SqNuSCPLIBXaQkZyeAhq8XGQ0yPNt9ixkXFRJ3AyP0dE+4 WiWXsjjevkHKdYJNL2BPu9XHHCgX8W6EygSk2Swwgg2dd5MItPktgXCyBzC+fKIBKGu6 TwqjX1uUIeRHGdtMj9Snsjq9Huyug17EpvTqVE3I/klgLScDegcVrhJZme8x9zXwQI1K MKBA== X-Forwarded-Encrypted: i=1; AJvYcCXdvhPrWuxPmj1BgAyQI1hwWQ7srp1TrfFMatmI+NM6tMrhtSoWhoZuY1+9tBmnjbHNSQeRsOrKjKk=@vger.kernel.org X-Gm-Message-State: AOJu0Ywdk2krV7Z0MBJqKYwoBlk01daF+2SKgI4r2Eqd4Q1jAvWlGDTQ viq+VDdwID2tlRp3rTa45Sa5zDb5m48uZrLqGiolp3emWtFuM3iwlCDjbfAvUmE= X-Gm-Gg: ASbGncsFt8imP46s7c4J5hFdfaX2Fyabkng2QZF1z+cPctI/TWVKOl4IqujguesD0sp 5vzHF9+SpIB4oAVT8A/nxYCNu69d5IuYRxt2t2v5LrLKXZ7jNvH4OM5e8DGh6uWvvW7hzszq9w9 OKiBi5YAJhRnU6UmDziwxhaU69UJttCBr+OCUFA+uWEOQoiqUn1e8Euv9xZ7vaflmGNbg91bLSa dsoMdBZrgBhC+mSCJ/JJNZqtIvdIkxBNKfMaWio8shSvZdusVFF4cTp9WincRUgP+UGWd9AZdKi aC0B6Q== 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 { }; /** - * 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 From patchwork Wed Nov 20 21:33:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881457 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 DE84A1C6F55 for ; Wed, 20 Nov 2024 21:34:05 +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=1732138447; cv=none; b=Au3KwYr9U1eASEsy/p4TZ5zBcx2KtOv6JD2yyyvO8jG/dpHs6JcRVMZYR60VwiwTcnwgjeAxZdayPeM9M+unAt6uUq9cRxfimpcfn4b1iLCYrsbqkMfGvbcIZ/DqpS7Dmb9cAFpPj0WS2IyCuvy8mKFtvu6wN0l1/lJnjmRXyP4= 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.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="qC7HF0d7" Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-2689e7a941fso214797fac.3 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=ufpmHjjZRLvOXH5rUk+kRRBl0OPYOlu6scGKxLe/U51i+y+JtojCOpjAZBYoGbNWAA GsZKacsLwtV4IgkPYrKkQrPseJzL8Z2JEUIWcv7pdaThM3M+xhdtI+TTxzdS+yqZtvnU 1T40Ljmlo8w7hOTujuHTlVc+TFwqnIgdWbvX0PQ6mUUruaJtQ+aUM74WJitqCs53iHZl pzTrkBHG04tp0H3MpYbVO+D9NLiIc/S9qTHyEY1YYzTWV+0i9OUAlVpFiFl+9fAl0yGG GnfXusFCa8wfCPkL6G1SfUVaKYOeoe7hAi39aKz0NZlVdps13dqYGvtVDD4qubzTsbrY n/Tg== X-Forwarded-Encrypted: i=1; AJvYcCWOmT0Jjc50vPQ/LmDt3lfDsdtW/ENzUaOJOvft2x8WXNksC9y7/8Cj1uGk68OI5lUqRgvt8O5Dh7o=@vger.kernel.org X-Gm-Message-State: AOJu0YzplywaYHx+GAG6d5c268nBHjt7apXDyYlHA+UgT/01IFTriIVL CmKFYoTLLg2eLglYNtWuosl5vSMNwnwcMI+CPoT+v9+CvRxieG+nwpr91ckfe4E= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 = 0; + int ret, i; indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); if (indio_dev == NULL) @@ -469,25 +470,14 @@ int ad5686_probe(struct device *dev, st->write = write; st->read = read; - st->reg = devm_regulator_get_optional(dev, "vcc"); - if (!IS_ERR(st->reg)) { - ret = regulator_enable(st->reg); - if (ret) - return ret; - - ret = regulator_get_voltage(st->reg); - if (ret < 0) - goto error_disable_reg; - - voltage_uv = ret; - } - st->chip_info = &ad5686_chip_info_tbl[chip_type]; - if (voltage_uv) - st->vref_mv = voltage_uv / 1000; - else - st->vref_mv = st->chip_info->int_vref_mv; + ret = devm_regulator_get_enable_read_voltage(dev, "vcc"); + if (ret < 0 && ret != -ENODEV) + return ret; + + has_external_vref = ret != -ENODEV; + st->vref_mv = has_external_vref ? ret / 1000 : st->chip_info->int_vref_mv; /* Set all the power down mode for all channels to 1K pulldown */ for (i = 0; i < st->chip_info->num_channels; i++) @@ -505,12 +495,12 @@ int ad5686_probe(struct device *dev, case AD5310_REGMAP: cmd = AD5686_CMD_CONTROL_REG; ref_bit_msk = AD5310_REF_BIT_MSK; - st->use_internal_vref = !voltage_uv; + st->use_internal_vref = !has_external_vref; break; case AD5683_REGMAP: cmd = AD5686_CMD_CONTROL_REG; ref_bit_msk = AD5683_REF_BIT_MSK; - st->use_internal_vref = !voltage_uv; + st->use_internal_vref = !has_external_vref; break; case AD5686_REGMAP: cmd = AD5686_CMD_INTERNAL_REFER_SETUP; @@ -519,40 +509,27 @@ int ad5686_probe(struct device *dev, case AD5693_REGMAP: cmd = AD5686_CMD_CONTROL_REG; ref_bit_msk = AD5693_REF_BIT_MSK; - st->use_internal_vref = !voltage_uv; + st->use_internal_vref = !has_external_vref; break; default: - ret = -EINVAL; - goto error_disable_reg; + return -EINVAL; } - val = (voltage_uv | ref_bit_msk); + val = (has_external_vref | ref_bit_msk); ret = st->write(st, cmd, 0, !!val); if (ret) - goto error_disable_reg; - - ret = iio_device_register(indio_dev); - if (ret) - goto error_disable_reg; - - return 0; + return ret; -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); void ad5686_remove(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad5686_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - if (!IS_ERR(st->reg)) - regulator_disable(st->reg); } EXPORT_SYMBOL_NS_GPL(ad5686_remove, IIO_AD5686); 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; From patchwork Wed Nov 20 21:33:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881458 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 B5CAC1C7292 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-296c184ed6bso213549fac.0 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=PxP8tdg//DFId9TpNmcCbXQku4v+aKxW7Jsg1pl3hPv8aJHjfF6rLU7fIZsrFYUAbb n3u2e4W1gyu8ks/wHoZcuWVSXzZcZFK4PJ0XIZA2owhh9PzbvYZ08n6rL7VxQ+UFdHj0 6gI38Q/xregHxBfPiFV9FOHuKDFiLU6Hf01Gw2f15vEtXi2BcnKKICcgFcx3vcBT/5iD VXkHJtZdxyHSR1vYQiNXsYRpbiybM5Niy6ApFYK+tYOtwqMBfKC67bmFF4l7lizoV8lr cHp2NK4pkGh7HEiLTiDT8x5m6IZOy7lgb3/vvKqooeovhAAJ1pXA+J8UCnh7vIB30tuV d3Iw== X-Forwarded-Encrypted: i=1; AJvYcCWVHTkwwL1Jo76KRyqLDhayw4cO1KPlAEGFgtzRCimp0STPpUaUGW4Xq3rBGrM4sn5JZgvyIqnX590=@vger.kernel.org X-Gm-Message-State: AOJu0YxVgCvtTDmwmdbmR+id701gAhsp8hgbpSOKcbRVP6eI5Xx/pKYD SZNJ+DhGtx1na3x0OJ5ez2Zik/Lgy1AMnTmxk9Te478Tioc7fwkrnsf/MpT0LZ8= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); } -static void ad5686_spi_remove(struct spi_device *spi) -{ - ad5686_remove(&spi->dev); -} - static const struct spi_device_id ad5686_spi_id[] = { {"ad5310r", ID_AD5310R}, {"ad5672r", ID_AD5672R}, @@ -126,7 +121,6 @@ static struct spi_driver ad5686_spi_driver = { .name = "ad5686", }, .probe = ad5686_spi_probe, - .remove = ad5686_spi_remove, .id_table = ad5686_spi_id, }; 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; st = iio_priv(indio_dev); - dev_set_drvdata(dev, indio_dev); st->dev = dev; st->write = write; @@ -521,18 +520,10 @@ int ad5686_probe(struct device *dev, if (ret) return ret; - return iio_device_register(indio_dev); + return devm_iio_device_register(dev, indio_dev); } EXPORT_SYMBOL_NS_GPL(ad5686_probe, IIO_AD5686); -void ad5686_remove(struct device *dev) -{ - struct iio_dev *indio_dev = 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); -void ad5686_remove(struct device *dev); - #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); } -static void ad5686_i2c_remove(struct i2c_client *i2c) -{ - ad5686_remove(&i2c->dev); -} - static const struct i2c_device_id ad5686_i2c_id[] = { {"ad5311r", ID_AD5311R}, {"ad5337r", ID_AD5337R}, @@ -116,7 +111,6 @@ static struct i2c_driver ad5686_i2c_driver = { .of_match_table = ad5686_of_match, }, .probe = ad5686_i2c_probe, - .remove = ad5686_i2c_remove, .id_table = ad5686_i2c_id, }; From patchwork Wed Nov 20 21:33:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881459 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) (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 50DFB176AC7 for ; Wed, 20 Nov 2024 21:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138450; cv=none; b=smidqXxTbhi1DOQQYTl9KUfgUfr6PhG1Eht5YxTBweV3ZNS9kYIWuUs6etkcZtbwxY3J55oa8EzEwC2W4vDvy/ZpeljKMExdypgRcYPwBiYlqdUjO7j0TLS+mHdHvYOVvPcWnx5CzyjnW/Wj40NnvHK8sb50ckmK7UM6gOcGS6g= 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.42 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-f42.google.com with SMTP id 586e51a60fabf-296bf028170so147049fac.3 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=vcZlovM/oc4rjtt3iSZKHIKNfVQhaqmlYuYKATKlxWXO+JzyFxuMulnT8DBtHpsd26 VtUAMtrxJ6l3/R2CKZQoLqW4gaiV6l/CVhUceRRzzXSUUkboY6B2JIk71PvmCAkiDMoz KTNKe0dtxsAZTSpBgBeHE6UQAwqbR9hjsJ20ANVYPYFoO3NmaltJG7x1n39z+YwdAwLs Qs0idwyLINfsLqW5P0/X7+IoGI0KRmG8d6TS44tWja709SlxzE+2LpqeE5aLxUXmWn0W qOfoY3pDqlAFo0naDgKFF7hHOJ6GnqAggmLl4aFAZsCI1oKnLruekJp4mWlwSHfCvSdE ovig== X-Forwarded-Encrypted: i=1; AJvYcCVTOy8AfHbL6ClKybrZcU9fKmVrFQKPl98qpiFPUoMJmBGyuVqEZz20QMj4Z9JHnF3yrhLNulZRQ6s=@vger.kernel.org X-Gm-Message-State: AOJu0Yyj/kC+ajsO/Y5CmT5/6Ao9O1wqF7KoDJ8bfZT0B5kuRYoAE/Lj alW2sPHHP6ZoWmVhssY9gN4GQ0AbELv7bCwgZ/Ycj1QVG/7o4QAnASexRqzs/oE= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 = st->spi; + int ret; st->gpio_reset = devm_gpiod_get_optional(&st->spi->dev, "reset", GPIOD_OUT_HIGH); @@ -784,24 +783,23 @@ static int ad7293_properties_parse(struct ad7293_state *st) return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_reset), "failed to get the reset GPIO\n"); - st->reg_avdd = devm_regulator_get(&spi->dev, "avdd"); - if (IS_ERR(st->reg_avdd)) - return dev_err_probe(&spi->dev, PTR_ERR(st->reg_avdd), + ret = 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; - st->reg_vdrive = devm_regulator_get(&spi->dev, "vdrive"); - if (IS_ERR(st->reg_vdrive)) - return dev_err_probe(&spi->dev, PTR_ERR(st->reg_vdrive), + ret = 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; return 0; } -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; - ret = regulator_enable(st->reg_avdd); - if (ret) { - dev_err(&spi->dev, - "Failed to enable specified AVDD Voltage!\n"); - return ret; - } - - ret = devm_add_action_or_reset(&spi->dev, ad7293_reg_disable, - st->reg_avdd); - if (ret) - return ret; - - ret = regulator_enable(st->reg_vdrive); - if (ret) { - dev_err(&spi->dev, - "Failed to enable specified VDRIVE Voltage!\n"); - return ret; - } - - ret = devm_add_action_or_reset(&spi->dev, ad7293_reg_disable, - st->reg_vdrive); - if (ret) - return ret; - - ret = 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 = 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 = __ad7293_spi_read(st, AD7293_REG_DEVICE_ID, &chip_id); if (ret) From patchwork Wed Nov 20 21:33:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881460 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 F2E401C9B82 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-295cee3a962so205383fac.3 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=Thn+UWdN8vOrUsMdsy3334XI8OX+9mDlnA/xYB4/IwF4E3QImUDwZm9y0upEenpTaT k4nBMWZTwfIcxKNb1fZG1Cf7N7TCPkPauPxmdxHIwPguCzLQ3c1SFb9VV7NKD92uPbny 8mWFHXMDeRAqOGvpIMr0Yio8/YSCC/jP8jGS5QuOWwYTf1clszcmwxp/Wdgxanbhhyh1 UbT9TAK+uvozSsKzBWj/FfEKoj5Hv41cnNs0FX9VdDrbiSCwuojteLg3CN3TaIesPoco OROfVwhOO/v8Pq93Y5gIVXd7Ek8d0relVebvW6BLSTrOgnveeAtjj32bfV2F+iIsAbBl 1jxQ== X-Forwarded-Encrypted: i=1; AJvYcCUG2s61FQHWuO58TYmruV1wDVcV/U2MfECoXi3fteTcJ9/dzgkRsBcuM08Gm+yj6Vik6MNFOakUXOU=@vger.kernel.org X-Gm-Message-State: AOJu0YzbCfHdUDzkx1gr88+FYYmuCxOqCLKYRsipVox4S2BKrS0vmmuZ Cm9fUcj8TbhPk/Y7maU2qGRzsofwE3iIf2mlfflAAoICsAs0v94n+lIe5z6u1iU= X-Gm-Gg: ASbGncs21aptGpvHrtMfu95wf+l0E6GkjrLC0RBKA2Sgo3LeIghRJemPfA7HPgukz78 lll7TXrnRtQZGMmzfMV7YiPf51gvtVep5BFfZ7vvT5ee9JPykwFAfhKg6uzcplhq1XtPAXs/7Wk 8jGtleWZCVJNa+sOP72pM6rn7Wkt1N6CopO2uJw8InZn2ttClTre8jqV7PvRbCuy/3E/vIsVotl mNJtqyoTsa/HyVXQ7Z6TP0wa0UUE/wNjuzHU32vTGJ5KtXPXszk7Gl4FlkVd53Y0QMQS7cgtLVY S0PIIQ== 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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; __be16 data __aligned(IIO_DMA_MINALIGN); }; @@ -122,51 +120,20 @@ static int ad8801_probe(struct spi_device *spi) state->spi = spi; id = spi_get_device_id(spi); - state->vrefh_reg = 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 = 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"); - ret = regulator_enable(state->vrefh_reg); - if (ret) { - dev_err(&spi->dev, "Failed to enable vrefh regulator: %d\n", - ret); - return ret; - } - - ret = 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 = ret / 1000; if (id->driver_data == ID_AD8803) { - state->vrefl_reg = devm_regulator_get(&spi->dev, "vrefl"); - if (IS_ERR(state->vrefl_reg)) { - ret = dev_err_probe(&spi->dev, PTR_ERR(state->vrefl_reg), - "Vrefl regulator not specified\n"); - goto error_disable_vrefh_reg; - } - - ret = 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 = 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 = 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 = ret / 1000; - } else { - state->vrefl_mv = 0; - state->vrefl_reg = NULL; } spi_set_drvdata(spi, indio_dev); @@ -177,31 +144,18 @@ static int ad8801_probe(struct spi_device *spi) indio_dev->name = id->name; ret = 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"); 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; } static void ad8801_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad8801_state *state = iio_priv(indio_dev); iio_device_unregister(indio_dev); - if (state->vrefl_reg) - regulator_disable(state->vrefl_reg); - regulator_disable(state->vrefh_reg); } static const struct spi_device_id ad8801_ids[] = { From patchwork Wed Nov 20 21:33:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881461 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (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 A9CB41C9DFC for ; Wed, 20 Nov 2024 21:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138453; cv=none; b=OUdciJ6TBI5unYxfM+ePjg1aOL/Wcc08hzqZN1gWD8XV4F9E4J97RV1Y8EAvqS4dNvuDe/4uv4hNtMxAvtxkan1mz8GoyYYMRYjzuPc/I+PfrMkcfW+VY/NyWpMmGD+oUyW/NUfWnbh61Cjv0yZdnbBNBJhPOaxIDaL4uvrQn1A= 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.50 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-f50.google.com with SMTP id 586e51a60fabf-296085d59caso212941fac.0 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=m877ghTOSm5F2VKaUBo3t/SBf1CXbOdGfR85rQZFvqbt4Z3PEKxH8YFfRm7U0V9JXJ xf9L2wpWLCoKcuFG02gMOnDN8dtAuEnK/rK27Bp63ZaDadeBtZjRVibkipo103szyyr1 nt2i+WVLQfix5p50i9NwvU+TIC1vJjDsSshA+Dq7kn1ynAbW72d5/sUMvbmd+UpO5pg7 x4vW30VLg+tJVKhyQz1OLFfprAJJBkb3Yt9GrXOV7NjddP34VoKbgXCkEFbxBZe+ABye WGNaQp+VmFSb/VeKhB3+ZI0V9yGi300iBXlm0IN6mnCCyuj1Ojbmw/0Wz/X9E5GtoDqO kpaQ== X-Forwarded-Encrypted: i=1; AJvYcCVvVyYx6FYMIc4Thti8VBUYEg8eNZ//BoBPlYLlGkLhyyjD9tjfrkODythVcOnIBseIefcdeZMq7UA=@vger.kernel.org X-Gm-Message-State: AOJu0YxT6IlZYnm2U26e63u1sMRRai5bHtpzcONn7+49+Hr2VicgDBE8 Q8j1Owjg8pDR8LowHtRH91Yjb4CRJ0D5oYK+EXWt0/JyrLlPbqMUObZ2ozPApKQ= X-Gm-Gg: ASbGnctuuPyfIDQbgpQd49gQtc6XunG6vJ+pu45btDgqFfcv2sVfHf4YAx1OdgbZq6Y uqSqIqaqepj6TJMdtLZy7HTU14sHo7u+pM0MyK/4ORs2GNZcx2oQd7BZvcINU74ChTbwlb232mS hAP+v45FujsRYO17g5meKAA4+bi90NxODECq6AM6pM0ulo/VdXb0WuAMdT1fG/0OZOTNDbWmyqI AMSA+B691StNZzD/JMssyneKdJUVX9TiqOFJD8m1dHa8chVkCG4G8rPi8M5zq1YYjMO6NdoyZeC B6/LeQ== 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 = ret / 1000; } - spi_set_drvdata(spi, indio_dev); indio_dev->info = &ad8801_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = ad8801_channels; indio_dev->num_channels = ARRAY_SIZE(ad8801_channels); indio_dev->name = id->name; - ret = iio_device_register(indio_dev); + ret = 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; } -static void ad8801_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - - iio_device_unregister(indio_dev); -} - static const struct spi_device_id ad8801_ids[] = { {"ad8801", ID_AD8801}, {"ad8803", ID_AD8803}, @@ -170,7 +162,6 @@ static struct spi_driver ad8801_driver = { .name = "ad8801", }, .probe = ad8801_probe, - .remove = ad8801_remove, .id_table = ad8801_ids, }; module_spi_driver(ad8801_driver); From patchwork Wed Nov 20 21:33:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881462 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 6679D1CACC4 for ; Wed, 20 Nov 2024 21:34:13 +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=1732138455; cv=none; b=kjiVg71yZd/qqUrSBys0iQ35JlS3W17lF05cpIaWIbKkIM8XBhE7L5Fa6NZlQJ5kOK2/+9Q2qaX3HnA6IHyAsylUelqQmtG0UrwsbkqZMzAjJw0zZHpRtpJFJ5s6VlTjuGQKtwYxf+gyzLhgsw+C4NG9IWUKahRiLyTr0Ck0vvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138455; 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=YJvutiDLpYUxdALJ/tOUwzkXP1a2oibe228rJx2hNJHkenuILtYxsQyAHIG7IUQQbUB9eoTg/PlfF24cWdZyobeiud7+PMXb+Og7tg8dteRS/nkww9/w//Atu3XAA4U9arswFUoB+C1Sd1WI6V64I0U5yjBX5It/wyzKIusO/I4= 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.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="S7GJH91g" Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-296252514c2so224041fac.3 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=OLw1eiTfQ/07Ov+QXb9mMhcecHUxdspCqo/qT+1Zh+LCQZ/U6IF/AgaOkIBdaQyoNj s72ZHCQ62U4qxwFfaYIO9D6Mw+ZeiPQvl3WsNjtrcFcZorq9YbaOYPI8xEm8x0/pdeTH EuqTNdlOEE2IFKgiJfXf39OsinmLqLrTe5AdHOUWqPeDotcOslpeIGoCZtKU9ivsanrC zajTwiktTikEJv9MpTc2P5Dj6cUCAuTB4e9Z07Ey0f01/oJIfrdk4uTOj0F02Y4j6RV0 ToZKn22+NrLw13dnb8LgECIBQW/IpgVbdh3PlbOqau9F+ThTE9urE6VlAiUKOigqKSmP p4SA== X-Forwarded-Encrypted: i=1; AJvYcCUruzeNV/9WkXqDGE9k0GNTRvllHVZVJYpTGabQCul9kUhEfaRIimUmY+VWtuOVrs5DhNn1GC5BTkI=@vger.kernel.org X-Gm-Message-State: AOJu0YxtRdIKy5d7o2xzKeAbLSNOMSnBX7H1Y8r2+tK15l6QletEfx8k 8Fy2McZ3etJMi/A2mIYnG+tZluhE6wJGvHxnheiwqhyJEDGzCGGx7oPcZcfP+X8= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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; }; 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; indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); @@ -324,43 +323,26 @@ static int ltc2632_probe(struct spi_device *spi) chip_info = (struct ltc2632_chip_info *) spi_get_device_id(spi)->driver_data; - st->vref_reg = devm_regulator_get_optional(&spi->dev, "vref"); - if (PTR_ERR(st->vref_reg) == -ENODEV) { - /* use internal reference voltage */ - st->vref_reg = NULL; - st->vref_mv = chip_info->vref_mv; + ret = devm_regulator_get_enable_read_voltage(&spi->dev, "vref"); + if (ret < 0 && ret != -ENODEV) + return dev_err_probe(&spi->dev, ret, + "Failed to get vref regulator voltage\n"); - ret = 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 = regulator_enable(st->vref_reg); - if (ret) { - dev_err(&spi->dev, - "enable reference regulator failed, %d\n", - ret); - return ret; - } - st->vref_mv = regulator_get_voltage(st->vref_reg) / 1000; + has_external_vref = ret != -ENODEV; + st->vref_mv = has_external_vref ? ret / 1000 : chip_info->vref_mv; + if (has_external_vref) { ret = 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 = 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"); } indio_dev->name = fwnode_get_name(dev_fwnode(&spi->dev)) ?: spi_get_device_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 = spi_get_drvdata(spi); - struct ltc2632_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); - - if (st->vref_reg) - regulator_disable(st->vref_reg); } static const struct spi_device_id ltc2632_id[] = { From patchwork Wed Nov 20 21:33:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881463 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) (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 387931BBBC5 for ; Wed, 20 Nov 2024 21:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138456; cv=none; b=nnbrVduAOFzvQukD6dJwHvmiT8htqOazkKSKyrd5xNHrQwxJKO7U8tXn98eB4oHWcFuPdKvyiov5M60G+VcfIdiAceEQ2Q2HizNM7WBn8dVb9Akbt9X/kwlIgQLL9+UzhpYvPLpDmU4jr4d16IikNSG7Qs/Y/CM0qVlZEiSHJak= 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.42 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-f42.google.com with SMTP id 586e51a60fabf-296252514c2so224058fac.3 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=ia8TBRjfxGqcNqA8ryaWKIxSPFSdbeNf/bITAJiUsnJl5IXKK/VyTJfkaR9n+dJkMt 7vutr1o2WjrPgbT44stZzaBrXAClMRB9qeXMYn2PM1yNVWNU4i7qT/lHKxcbEAJ8Dui2 1P3IoJ8Mv0DmVlDWyRLpOkbSvKgPY8OANjGTeq14otiC+AWJof7En4OavwCdWvHhBA2j 6//BBPHOsE2LynpPpEub13J2tWnZE/5rwhh3I5lpYrCIKLvSoahdl3nXDudq+JWyenbk +1+PMAJZ2ezwBIF2zSv+QLfN11JJjh0fj1odaTXmGq7KVh67raagMAwXmd+FKsaWqIKV gUsA== X-Forwarded-Encrypted: i=1; AJvYcCX5x3EMegGpJ3jlcJ7O2uAoyRIYYhVWi1+bZU2S5SEJjTteVYnjyMsJECNFopWnLWjA9r0BaSK3waM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3wOKw/tB8aSTKAuDfKeo5m0yQr0hdELH+pRzEJ6pPl0qQrBUz R/93f0J4m70OdnaGezflcAgXKMiYKui5GWzj8vLR0mTF40rIV87VIxL+iY0o0xQ= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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) st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); st->spi_dev = spi; chip_info = (struct ltc2632_chip_info *) @@ -351,14 +350,7 @@ static int ltc2632_probe(struct spi_device *spi) indio_dev->channels = chip_info->channels; indio_dev->num_channels = chip_info->num_channels; - return iio_device_register(indio_dev); -} - -static void ltc2632_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - - iio_device_unregister(indio_dev); + return devm_iio_device_register(&spi->dev, indio_dev); } static const struct spi_device_id ltc2632_id[] = { @@ -450,7 +442,6 @@ static struct spi_driver ltc2632_driver = { .of_match_table = ltc2632_of_match, }, .probe = ltc2632_probe, - .remove = ltc2632_remove, .id_table = ltc2632_id, }; module_spi_driver(ltc2632_driver); From patchwork Wed Nov 20 21:33:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881464 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.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 E29A61CB328 for ; Wed, 20 Nov 2024 21:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138457; cv=none; b=C1OXQomc4xLBqli5XZ2L1Q3FU6WfG238azmaHHJP1cxn7zq82OZPhW8yj+DF+Zm8quViMYM9lUlMWh/0TpggfFD/lPLrhKvjndgH9bek9giITbhR8QIQp2Parbh7JcBNA/TV6dUJPrw0Mred3nIZOKlEEG+r9adeSdLpc5/Ttag= 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.161.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="eWdCakaS" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5ebc0e13d25so108637eaf.1 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=UH7IrEbNDKhzzN7AF0iEUn8Lu52eEGCscgZqdBlkv+bHBECoxzU4lDMXH4cVKxriV6 mervB77oUuLMlDS+SlX6hveIEwxiYZ4eD59TT8qnSFKXKmUvUOykTC/sLzhj688WpY4s YWl/kizeGdHorPnGFEwYkZ4SMf0u5F12N2lmN7Idq1pliyhnrmB1/dNbsrn55OJa+Olz 2i7ecNbD0Y4076p48HDjp+zbTvKVvEeVNVYQorJF1/5mYgYKEVbxUJe3h1OvYI7fgJ53 8i19x5pK9qLrduRpWk3SoNatumFGwKFNupi0s74gHmwbvFik3MHwDLKZ/V43xU+Cu3Im +pNg== X-Forwarded-Encrypted: i=1; AJvYcCXi7Lb0WpuPXGuDiSLM9rLSs1dHyR9+fVmxv1P3w4J7c0sn16ZxlwWNTpViadaZYqF7T0EjMq1MpC4=@vger.kernel.org X-Gm-Message-State: AOJu0YwEmQs46qB4ugUV7mkT+zrjQ8p1rhuWKNAyxE6fSkAKLbFzucQ2 R3AN/PUrEPNt1bKsSRJbl9HJ6c5PR8NX1smmuRRHbIJ+93aCQUx0VeIyjC72dIQ= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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; } -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 = &st->spi->dev; struct gpio_desc *gpio; @@ -881,18 +881,13 @@ static int ltc2688_setup(struct ltc2688_state *st, struct regulator *vref) if (ret) return ret; - if (!vref) + if (!has_external_vref) return 0; return regmap_set_bits(st->regmap, LTC2688_CMD_CONFIG, LTC2688_CONFIG_EXT_REF); } -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[] = { "vcc", "iovcc" }; struct ltc2688_state *st; struct iio_dev *indio_dev; - struct regulator *vref_reg; struct device *dev = &spi->dev; + bool has_external_vref; int ret; indio_dev = 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"); - vref_reg = devm_regulator_get_optional(dev, "vref"); - if (IS_ERR(vref_reg)) { - if (PTR_ERR(vref_reg) != -ENODEV) - return dev_err_probe(dev, PTR_ERR(vref_reg), - "Failed to get vref regulator"); - - vref_reg = NULL; - /* internal reference */ - st->vref = 4096; - } else { - ret = regulator_enable(vref_reg); - if (ret) - return dev_err_probe(dev, ret, - "Failed to enable vref regulators\n"); - - ret = devm_add_action_or_reset(dev, ltc2688_disable_regulator, - vref_reg); - if (ret) - return ret; - - ret = regulator_get_voltage(vref_reg); - if (ret < 0) - return dev_err_probe(dev, ret, "Failed to get vref\n"); + ret = devm_regulator_get_enable_read_voltage(dev, "vref"); + if (ret < 0 && ret != -ENODEV) + return dev_err_probe(dev, ret, + "Failed to get vref regulator voltage\n"); - st->vref = ret / 1000; - } + has_external_vref = ret != -ENODEV; + st->vref = has_external_vref ? ret / 1000 : 0; - ret = ltc2688_setup(st, vref_reg); + ret = ltc2688_setup(st, has_external_vref); if (ret) return ret; From patchwork Wed Nov 20 21:33:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13881465 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.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 896F51CB32F for ; Wed, 20 Nov 2024 21:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732138458; cv=none; b=f3nB9p+H1TgAf1Ggdwjx8utR4Geb00xm8jA4rXD4w4xyMJwh+aRN5y09LJA1u+F9DTTs+yv8/qOxZ0r3SjTRnKtVklFj11WfuTXKMyrtzh6SgoNnNNtTZvfZfQoyUN8Fl4qfopz3VN01Vb44rJFjFc667AMJon0TjQfNNq6h+ZA= 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.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="dHuSg9Tq" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5ee58c5c2e3so137681eaf.2 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=L/m665EL/8KsUu/p35UoBDgpQs2BbpNwkgEI9Pob4h5LohbIjWo4ExBGNR9hGkB1Bc ja8HMPuodkYMC7TwnxZl+OC82coRJGodqsMSwTnDZvrPpQcrMcdgSeFYkVj8eXx6kdnq EcQTHbVDer1GN8F5x7SFqBoSpUTzSt7pRyU/Gl+bqpRTA6wByfgXwYBePLYHIXpqDG9M mDIElK9QAVubEMqzkGrix2O4rxFrOqq0MLjbFNhtwsEA0Urr4zp59qs2zzxBVI8tQQqJ biJrzVkywQzXcAeJeJAlFgzNMc425c+6L+xCJko2gx2IWNG6DtjBzSKmBwc9fW7uMRzO YreA== X-Forwarded-Encrypted: i=1; AJvYcCVki8zehCdX4gFpl0OaD0XAhiKbF0pQRgaDM1ax08IfuVYGDzmE15qXsBW139GO4nWsiXUMUR1X5Ug=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4F3zv7++03zVuZJTAYJPigd0l2E/UxcKsiMQI5zGzV9zSn1Wj XHO6iy8rV/nrve+hiXffDpf/cmNWu4stDkTYckMhleyl88r3OvWFMoQdeMGlmao= 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 { 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 = { .write_raw = max5821_write_raw, }; -static void max5821_regulator_disable(void *reg) -{ - regulator_disable(reg); -} - static int max5821_probe(struct i2c_client *client) { const struct i2c_device_id *id = i2c_client_get_device_id(client); @@ -321,32 +315,10 @@ static int max5821_probe(struct i2c_client *client) data->powerdown_mode[tmp] = MAX5821_100KOHM_TO_GND; } - data->vref_reg = 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 = regulator_enable(data->vref_reg); - if (ret) { - dev_err(&client->dev, - "Failed to enable vref regulator: %d\n", ret); - return ret; - } - - ret = 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 = 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 = 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"); data->vref_mv = ret / 1000;