[ Upstream commit a7083763619f7485ccdade160deb81737cf2732f ]
A new warning in clang points out two instances where boolean
expressions are being used with a bitwise OR instead of logical OR:
drivers/soc/tegra/fuse/speedo-tegra20.c:72:9: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
reg = tegra_fuse_read_spare(i) |
^~~~~~~~~~~~~~~~~~~~~~~~~~
||
drivers/soc/tegra/fuse/speedo-tegra20.c:72:9: note: cast one or both operands to int to silence this warning
drivers/soc/tegra/fuse/speedo-tegra20.c:87:9: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
reg = tegra_fuse_read_spare(i) |
^~~~~~~~~~~~~~~~~~~~~~~~~~
||
drivers/soc/tegra/fuse/speedo-tegra20.c:87:9: note: cast one or both operands to int to silence this warning
2 warnings generated.
The motivation for the warning is that logical operations short circuit
while bitwise operations do not.
In this instance, tegra_fuse_read_spare() is not semantically returning
a boolean, it is returning a bit value. Use u32 for its return type so
that it can be used with either bitwise or boolean operators without any
warnings.
Fixes: 25cd5a3914
("ARM: tegra: Add speedo-based process identification")
Link: https://github.com/ClangBuiltLinux/linux/issues/1488
Suggested-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
104 lines
2.4 KiB
C
104 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2010 Google, Inc.
|
|
* Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* Author:
|
|
* Colin Cross <ccross@android.com>
|
|
*/
|
|
|
|
#ifndef __DRIVERS_MISC_TEGRA_FUSE_H
|
|
#define __DRIVERS_MISC_TEGRA_FUSE_H
|
|
|
|
#include <linux/dmaengine.h>
|
|
#include <linux/types.h>
|
|
|
|
struct tegra_fuse;
|
|
|
|
struct tegra_fuse_info {
|
|
u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
|
|
unsigned int size;
|
|
unsigned int spare;
|
|
};
|
|
|
|
struct tegra_fuse_soc {
|
|
void (*init)(struct tegra_fuse *fuse);
|
|
void (*speedo_init)(struct tegra_sku_info *info);
|
|
int (*probe)(struct tegra_fuse *fuse);
|
|
|
|
const struct tegra_fuse_info *info;
|
|
};
|
|
|
|
struct tegra_fuse {
|
|
struct device *dev;
|
|
void __iomem *base;
|
|
phys_addr_t phys;
|
|
struct clk *clk;
|
|
|
|
u32 (*read_early)(struct tegra_fuse *fuse, unsigned int offset);
|
|
u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
|
|
const struct tegra_fuse_soc *soc;
|
|
|
|
/* APBDMA on Tegra20 */
|
|
struct {
|
|
struct mutex lock;
|
|
struct completion wait;
|
|
struct dma_chan *chan;
|
|
struct dma_slave_config config;
|
|
dma_addr_t phys;
|
|
u32 *virt;
|
|
} apbdma;
|
|
};
|
|
|
|
void tegra_init_revision(void);
|
|
void tegra_init_apbmisc(void);
|
|
|
|
u32 __init tegra_fuse_read_spare(unsigned int spare);
|
|
u32 __init tegra_fuse_read_early(unsigned int offset);
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
|
|
void tegra20_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_3x_SOC
|
|
void tegra30_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_114_SOC
|
|
void tegra114_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
#endif
|
|
|
|
#if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
|
|
void tegra124_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_210_SOC
|
|
void tegra210_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
|
|
extern const struct tegra_fuse_soc tegra20_fuse_soc;
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_3x_SOC
|
|
extern const struct tegra_fuse_soc tegra30_fuse_soc;
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_114_SOC
|
|
extern const struct tegra_fuse_soc tegra114_fuse_soc;
|
|
#endif
|
|
|
|
#if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
|
|
extern const struct tegra_fuse_soc tegra124_fuse_soc;
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_210_SOC
|
|
extern const struct tegra_fuse_soc tegra210_fuse_soc;
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_186_SOC
|
|
extern const struct tegra_fuse_soc tegra186_fuse_soc;
|
|
#endif
|
|
|
|
#endif
|