Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp227891lqd; Tue, 23 Apr 2024 23:34:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXY2PWq+eN5Zdzj2epBrDy9152+OvkhigZxb52L+ZP/pBYFeYCBkJZ9aJ283sxsw4DAWPZELbx/D4lEHT1q1IwNrczHKQaeoANLqXincg== X-Google-Smtp-Source: AGHT+IHy31gzUiaaA0qFpEzf6QZuYTAl0EBdVPU/BCgjnJGHm5old8pRXfmHqAZB4wXsd0rJvChK X-Received: by 2002:a0c:f28c:0:b0:699:1b4e:86dd with SMTP id k12-20020a0cf28c000000b006991b4e86ddmr1537692qvl.46.1713940497888; Tue, 23 Apr 2024 23:34:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713940497; cv=pass; d=google.com; s=arc-20160816; b=swaVQ443BmW9DXnW3fXCe51x5HpyGwyhyiNbD/OgwVUQatPvZnQP1MNTVw+GAExDPa r5dSxTUv1+jXxePJW6Nni7+uHLxLwTtJWw7BSYadU4M9JdXNiNHIC92Mvx5WRkxtF9zU zmCqRouYoUdWiGW054q1KydtHQDt5xHJIyJHqH5b8lPl4P3xae+CpE4DVU+RrYrCK3aQ 3Y5z0hRZd2igpogGBAqRfi5QjOaDCDMPgIccESXD0yvU28i1b65V2FkNtH9oASTpg5fH VF/2CBcirqwJJ+mXG5XvVQ0asu3cq8VlYB+1EkCjRfA6KsS69fT3WZuPSaavVCCB7Dl8 XWHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=6p3Yarxk022et2ZwwjsfZpOXrzRFD/8ByRQ5jszgr7c=; fh=+ojXJv0/4efHC+ZKQpCuefisvk/g778RKYDrPGgHhHg=; b=H0C3HeamNGy+PvhxjlUGJBsWZbB6+KedM+FRMg0hcUplatkeQ5EInu3bTQeHrUOTbq rmWy18/DJh5m427d1IcD9Lhi0aQcsRf7nwj/qJe/AcpJz27FfxVymGJ0e+xu0ad487kb b+dq/7d6zUupIRM5Xm0wGV6G/4xV2SkBkGPCoN8njGa5FCaRRUfmo//GOcRz2j0QckBQ vakhxmoKICImQSmUxzPgEJijLgp50Cv8v3IuqQfdRvkhwrV89loieGED6e5IFyzNTSPQ PJA/tfZWLAhr9aXClGn6/+DhW3Ci5vN1VUkVd/+99PnvyUz0j0u0fR3OgjtQ18TpdbGc fbBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBJFB4ee; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156365-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gy13-20020a056214242d00b00696a6bb9229si14423207qvb.179.2024.04.23.23.34.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 23:34:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBJFB4ee; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156365-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9D3951C21EE8 for ; Wed, 24 Apr 2024 06:34:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F357157A63; Wed, 24 Apr 2024 06:34:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QBJFB4ee" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FF8036D; Wed, 24 Apr 2024 06:34:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713940476; cv=none; b=MHqAzRsnIcwU832gdgtYXsn4diP5WKUtlPcAPtwuH/MG6XoIEoJwMpFTaH0m73hjRogdOXt0o5gFt/kXDNtDwFgThogemcyNNCc9eRdCUxLmhk/XUxF18cnxGtVk6H363vCnsjg8FwL2fEZtUp2kUvfzmAs3a3sosH/bUTA7P0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713940476; c=relaxed/simple; bh=I0CDR+UQx8pIKK08mZpMwJPZrKmFX4+NzKjWxZIyAxI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sDE9ettY1rM5TUGHGzYxG0/4x5lgfCPj9fEd0+APpnYeApy+sfcqsiOWIKrtBl6MSmqCLfrmJljIKJ6Zq9sumi2MAVV9/7JoL0vIH0cBmkLFsmUlGUOIoRplv2Ai+8hZjYOcT6QGnjzktjguiyh8c75LIucTH3asjH90H3398rA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QBJFB4ee; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34F01C113CE; Wed, 24 Apr 2024 06:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713940475; bh=I0CDR+UQx8pIKK08mZpMwJPZrKmFX4+NzKjWxZIyAxI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QBJFB4eeLiwx6Tk0ZFRvPcqclvVhyVA2EwZfNQSyXujJ8QtJD/n475SuWDEASe9bD XMZ5Z2vChp5bVOhPvB7GLWWJ7zTw1Z5UnBt2sZIcPcoCNOfl+x6IFU8H2Fih5BDX6u dVfpLJ2RU+9VGQy1Xr+yZf3o1NuXDCXfdNLb+/IcVc8cPuBrSMHktl+WluY+dsw7RA cJKAndzVhW264t+z9juKA0UiEZcXOaMoPw6A0tvpn+Q2o7ahErjYbkcm1k39goL65s SGmt53gd5Ss4UQVLWL5skfc5PuZhayItc58+I/lAkaCHLsBGBRcZ/KP7Bv7qKBFVXw v97NNQBQCHYcw== From: Krzysztof Kozlowski Date: Wed, 24 Apr 2024 08:33:27 +0200 Subject: [PATCH v2 01/19] backlight: Constify lcd_ops 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: 7bit Message-Id: <20240424-video-backlight-lcd-ops-v2-1-1aaa82b07bc6@kernel.org> References: <20240424-video-backlight-lcd-ops-v2-0-1aaa82b07bc6@kernel.org> In-Reply-To: <20240424-video-backlight-lcd-ops-v2-0-1aaa82b07bc6@kernel.org> To: Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller , =?utf-8?q?Bruno_Pr=C3=A9mont?= , Jiri Kosina , Benjamin Tissoires , Alexander Shiyan , Sascha Hauer , Pengutronix Kernel Team , Shawn Guo , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2491; i=krzk@kernel.org; h=from:subject:message-id; bh=I0CDR+UQx8pIKK08mZpMwJPZrKmFX4+NzKjWxZIyAxI=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmKKfeToXpF7L2yVN9k2sqZfozve2s4THf0Vo2R epNlzurbF+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZiin3gAKCRDBN2bmhouD 19p1D/99+NJcxUjp5prNBS/1AhHZ7jpcTNsKZmpAaP58DryULCGl5CfY7sVAD0rs3R/AnzX/+p4 K64AwvGNoyqke7ajX+ZHzin8hbv8N+9C/iil1xQCl0VDFMYe8M/rplcsBp2fYe/Yb47R/8CZkmg WJ3+jNA3rifj9dWGXV4pMUfLEgW1gpoPNmCUhIBa3pBacJUetd4RuBgIg4jWcUT1OugVlz/H2jM TKgrDRbS8HsrA8s8bU423MeunN2T9+vgeOVbUtfZMZ430Fw66qm0wRQUVdyxdCWe7JDEiGA5CfL 3lX7PProDKUMmvFLsj1kVeGi0HQEznRVIck2RrTwx+Ff8QKPXk8KKOTBHiKjrKmVErFuLg/EZzg bupLP1D7A4TTmrXZfHgPmlx9W1614sglt/194qIPrLe76HeSX4o4r7xEYdgOre7Y90Y+wfGyG6M iheqT7BDxETuYD4Y5MRcCUnTWX4fDupaDhJyruDQl4OVA6CWi6oKMAMpMf17NpHOoVpx+RM58n/ 7NLfOwkSHP2ORpqsofr6EWyxnv+/2YnS0Qj94hh136eZLVOCNA8E6HMiS8AcoYCDwWLPBpwd9CH 3m9CRX9Am9eJa2D9BquLDAGS72/UAnrXBuVoMZNj9CEToM9aDym6N7DX0EW6LgbTRWl9KPYju+2 KYXG6toKDyMZMkA== X-Developer-Key: i=krzk@kernel.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B 'struct lcd_ops' passed in lcd_device_register() is not modified by core backlight code, so it can be made const for code safety. This allows drivers to also define the structure as const. Reviewed-by: Daniel Thompson Signed-off-by: Krzysztof Kozlowski --- drivers/video/backlight/lcd.c | 4 ++-- include/linux/lcd.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index ba4771cbd781..ceec90ca758b 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -191,7 +191,7 @@ static const struct class lcd_class = { * or a pointer to the newly allocated device. */ struct lcd_device *lcd_device_register(const char *name, struct device *parent, - void *devdata, struct lcd_ops *ops) + void *devdata, const struct lcd_ops *ops) { struct lcd_device *new_ld; int rc; @@ -279,7 +279,7 @@ static int devm_lcd_device_match(struct device *dev, void *res, void *data) */ struct lcd_device *devm_lcd_device_register(struct device *dev, const char *name, struct device *parent, - void *devdata, struct lcd_ops *ops) + void *devdata, const struct lcd_ops *ops) { struct lcd_device **ptr, *lcd; diff --git a/include/linux/lcd.h b/include/linux/lcd.h index 238fb1dfed98..68703a51dc53 100644 --- a/include/linux/lcd.h +++ b/include/linux/lcd.h @@ -61,7 +61,7 @@ struct lcd_device { points to something in the body of that driver, it is also invalid. */ struct mutex ops_lock; /* If this is NULL, the backing module is unloaded */ - struct lcd_ops *ops; + const struct lcd_ops *ops; /* Serialise access to set_power method */ struct mutex update_lock; /* The framebuffer notifier block */ @@ -102,10 +102,10 @@ static inline void lcd_set_power(struct lcd_device *ld, int power) } extern struct lcd_device *lcd_device_register(const char *name, - struct device *parent, void *devdata, struct lcd_ops *ops); + struct device *parent, void *devdata, const struct lcd_ops *ops); extern struct lcd_device *devm_lcd_device_register(struct device *dev, const char *name, struct device *parent, - void *devdata, struct lcd_ops *ops); + void *devdata, const struct lcd_ops *ops); extern void lcd_device_unregister(struct lcd_device *ld); extern void devm_lcd_device_unregister(struct device *dev, struct lcd_device *ld); -- 2.43.0