mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-14 06:22:34 +02:00
Sashiko reported an inconsistent use of NULL vs ERR_PTR()
returns in the stub helpers in xynos-acpm-protocol.h.
Since this only happens on dead code for COMPILE_TEST=y, this is not
really a bug though. Having stub functions that return NULL is a common
way to define optional interfaces, where callers still work when the
feature is disabled, though this clearly does not work for acpm because
some callers have a NULL pointer dereference when compile testing.
Since CONFIG_EXYNOS_ACPM_PROTOCOL already supports compile-testing itself,
and all (both) drivers using it clearly require the support, so this
just simplifies the option space without losing any build coverage.
Remove the stub functions entirely and adjust the one Kconfig
dependency to require EXYNOS_ACPM_PROTOCOL unconditionally.
Fixes: 6837c006d4 ("firmware: exynos-acpm: add empty method to allow compile test")
Closes: https://sashiko.dev/#/patchset/20260420-acpm-tmu-v3-0-3dc8e93f0b26%40linaro.org
Link: https://lore.kernel.org/all/a7994860-24a3-4f87-84bf-109ed653dda4@linaro.org/
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260529134454.2147446-1-arnd@kernel.org
[krzk: Rebase on difference in devm_acpm_get_by_node()]
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
75 lines
2.4 KiB
C
75 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright 2020 Samsung Electronics Co., Ltd.
|
|
* Copyright 2020 Google LLC.
|
|
* Copyright 2024 Linaro Ltd.
|
|
*/
|
|
|
|
#ifndef __EXYNOS_ACPM_PROTOCOL_H
|
|
#define __EXYNOS_ACPM_PROTOCOL_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct acpm_handle;
|
|
struct device_node;
|
|
|
|
struct acpm_dvfs_ops {
|
|
int (*set_rate)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
unsigned int clk_id, unsigned long rate);
|
|
unsigned long (*get_rate)(struct acpm_handle *handle,
|
|
unsigned int acpm_chan_id,
|
|
unsigned int clk_id);
|
|
};
|
|
|
|
struct acpm_pmic_ops {
|
|
int (*read_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
u8 type, u8 reg, u8 chan, u8 *buf);
|
|
int (*bulk_read)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
u8 type, u8 reg, u8 chan, u8 count, u8 *buf);
|
|
int (*write_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
u8 type, u8 reg, u8 chan, u8 value);
|
|
int (*bulk_write)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
u8 type, u8 reg, u8 chan, u8 count, const u8 *buf);
|
|
int (*update_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
u8 type, u8 reg, u8 chan, u8 value, u8 mask);
|
|
};
|
|
|
|
struct acpm_tmu_ops {
|
|
int (*init)(struct acpm_handle *handle, unsigned int acpm_chan_id);
|
|
int (*read_temp)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
u8 tz, int *temp);
|
|
int (*set_threshold)(struct acpm_handle *handle,
|
|
unsigned int acpm_chan_id, u8 tz,
|
|
const u8 temperature[8], size_t tlen);
|
|
int (*set_interrupt_enable)(struct acpm_handle *handle,
|
|
unsigned int acpm_chan_id, u8 tz, u8 inten);
|
|
int (*tz_control)(struct acpm_handle *handle, unsigned int acpm_chan_id,
|
|
u8 tz, bool enable);
|
|
int (*clear_tz_irq)(struct acpm_handle *handle,
|
|
unsigned int acpm_chan_id, u8 tz);
|
|
int (*suspend)(struct acpm_handle *handle, unsigned int acpm_chan_id);
|
|
int (*resume)(struct acpm_handle *handle, unsigned int acpm_chan_id);
|
|
};
|
|
|
|
struct acpm_ops {
|
|
struct acpm_dvfs_ops dvfs;
|
|
struct acpm_pmic_ops pmic;
|
|
struct acpm_tmu_ops tmu;
|
|
};
|
|
|
|
/**
|
|
* struct acpm_handle - Reference to an initialized protocol instance
|
|
* @ops: pointer to the constant ACPM protocol operations.
|
|
*/
|
|
struct acpm_handle {
|
|
const struct acpm_ops *ops;
|
|
};
|
|
|
|
struct device;
|
|
|
|
struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
|
|
struct device_node *np);
|
|
struct acpm_handle *devm_acpm_get_by_phandle(struct device *dev);
|
|
|
|
#endif /* __EXYNOS_ACPM_PROTOCOL_H */
|