Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 14 additions & 26 deletions drivers/iio/adc/ad9081.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@
static long ad9081_bb_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
struct ad9081_clock *clk_priv = to_clk_priv(hw);

Check warning on line 640 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'clk_priv' during its initialization is never read [deadcode.DeadStores] 640 | struct ad9081_clock *clk_priv = to_clk_priv(hw); | ^~~~~~~~ ~~~~~~~~~~~~~~~

dev_dbg(&clk_priv->spi->dev, "%s: Rate %lu Hz", __func__, rate);

Expand Down Expand Up @@ -1334,6 +1334,8 @@
}
ret = sysfs_emit(buf, "%lld\n",
phy->tx_ffh_hopf_vals[phy->tx_ffh_hopf_index[cddc_num]][cddc_num]);
if (ret <= 0)
ret = -EINVAL;
break;
default:
ret = -EINVAL;
Expand Down Expand Up @@ -2680,7 +2682,6 @@
{
struct axiadc_converter *conv = iio_device_get_drvdata(indio_dev);
struct ad9081_phy *phy = conv->phy;
unsigned long r_clk;
int ret;

guard(mutex)(&conv->lock);
Expand All @@ -2697,18 +2698,6 @@
return -EPERM;

return ad9081_set_sample_rate(conv, val);

r_clk = clk_round_rate(conv->clk, val);
if (r_clk < 0 || r_clk > conv->chip_info->max_rate) {
dev_warn(&conv->spi->dev,
"Error setting ADC sample rate %ld", r_clk);
return -EINVAL;
}

ret = clk_set_rate(conv->clk, r_clk);
if (ret < 0)
return ret;
break;
case IIO_CHAN_INFO_ENABLE:
if (chan->output) {
u8 cddc_num, cddc_mask, fddc_num, fddc_mask;
Expand Down Expand Up @@ -3206,6 +3195,8 @@
u16 stat;
u8 vals[3];

guard(mutex)(&conv->lock);

for (l = AD9081_LINK_0; !phy->tx_disable && (l < (ad9081_link_is_dual(phy->jrx_link_tx) ?
AD9081_LINK_ALL : AD9081_LINK_1)); l++) {

Expand Down Expand Up @@ -3260,9 +3251,6 @@
return 0;
}




static void ad9081_work_func(struct work_struct *work)
{
u8 status;
Expand All @@ -3270,7 +3258,7 @@
struct ad9081_phy *phy =
container_of(work, struct ad9081_phy, dwork.work);

ret = adi_ad9081_hal_reg_get(&phy->ad9081, REG_IRQ_STATUS0_ADDR,

Check warning on line 3261 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 3261 | ret = adi_ad9081_hal_reg_get(&phy->ad9081, REG_IRQ_STATUS0_ADDR, | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3262 | &status); | ~~~~~~~~
&status);

if (!(status & BIT(6))) {
Expand Down Expand Up @@ -3568,6 +3556,8 @@
struct axiadc_converter *conv = iio_device_get_drvdata(indio_dev);
struct ad9081_phy *phy = conv->phy;

guard(mutex)(&conv->lock);

return ad9081_parse_fir(phy, buf, count);
}

Expand Down Expand Up @@ -3652,7 +3642,7 @@

for (j = 0; j < 8; j++)
if (phy->jrx_link_tx[0].logiclane_mapping[j] == i) {
ret = adi_ad9081_jesd_rx_phy_prbs_test_result_get(

Check warning on line 3645 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 3645 | ret = adi_ad9081_jesd_rx_phy_prbs_test_result_get( | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3646 | &phy->ad9081, j, &prbs_rx_result); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&phy->ad9081, j, &prbs_rx_result);

len += snprintf(phy->dbuf + len, sizeof(phy->dbuf), "%u/%u ",
Expand All @@ -3668,7 +3658,7 @@

for (j = 0; j < 8; j++)
if (phy->jrx_link_tx[1].logiclane_mapping[j] == i) {
ret = adi_ad9081_jesd_rx_phy_prbs_test_result_get(&phy->ad9081,

Check warning on line 3661 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 3661 | ret = adi_ad9081_jesd_rx_phy_prbs_test_result_get(&phy->ad9081, | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3662 | j, &prbs_rx_result); | ~~~~~~~~~~~~~~~~~~~
j, &prbs_rx_result);

len += snprintf(phy->dbuf + len, sizeof(phy->dbuf), "%u/%u ",
Expand Down Expand Up @@ -3731,7 +3721,7 @@
lane, spo_steps, phy->jrx_link_tx[0].lane_rate_kbps);

for (i = 0; i < (spo_steps * 3); i += 3)
if (eye_data[i + 1] || eye_data[i + 2])

Check warning on line 3724 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Branch condition evaluates to a garbage value [core.uninitialized.Branch] 3724 | if (eye_data[i + 1] || eye_data[i + 2]) | ^~~~~~~~~~~~~~~
len += snprintf(phy->dbuf + len,
sizeof(phy->dbuf),
"%d,%d,%d\n", eye_data[i],
Expand Down Expand Up @@ -4184,7 +4174,7 @@

static int ad9081_parse_dt_tx(struct ad9081_phy *phy, struct device_node *np)
{
struct device_node *of_channels, *of_chan;
struct device_node *of_channels;
struct device_node *of_trx_path;
u32 reg, index, tmp, value;
bool has_long_time = false, has_long_thresh = false;
Expand Down Expand Up @@ -4237,7 +4227,7 @@
return ret;
}

for_each_child_of_node(of_channels, of_chan) {
for_each_child_of_node_scoped(of_channels, of_chan) {
ret = of_property_read_u32(of_chan, "reg", &reg);
if (!ret && (reg < ARRAY_SIZE(phy->tx_main_shift))) {
of_property_read_u64(of_chan,
Expand Down Expand Up @@ -4395,7 +4385,7 @@
return ret;
}

for_each_child_of_node(of_channels, of_chan) {
for_each_child_of_node_scoped(of_channels, of_chan) {
ret = of_property_read_u32(of_chan, "reg", &reg);
if (!ret && (reg < ARRAY_SIZE(phy->tx_chan_shift))) {
u32 val;
Expand Down Expand Up @@ -4436,7 +4426,7 @@
phy->jrx_link_watchdog_en = of_property_read_bool(of_channels,
"adi,jrx-link-watchdog-enable");

for_each_child_of_node(of_channels, of_chan) {
for_each_child_of_node_scoped(of_channels, of_chan) {
ret = of_property_read_u32(of_chan, "reg", &reg);
if (!ret && (reg < ARRAY_SIZE(phy->jrx_link_tx))) {
ad9081_parse_jesd_link_dt(phy, of_chan,
Expand All @@ -4445,7 +4435,6 @@
dev_err(&phy->spi->dev,
"Missing or invalid reg property in tx jesd-links node (%d)\n",
reg);
of_node_put(of_chan);
break;
}
}
Expand All @@ -4458,7 +4447,7 @@

static int ad9081_parse_dt_rx(struct ad9081_phy *phy, struct device_node *np)
{
struct device_node *of_channels, *of_chan;
struct device_node *of_channels;
struct device_node *of_trx_path;
u32 reg, tmp, nz;
int ret, i;
Expand Down Expand Up @@ -4495,7 +4484,7 @@
return -ENODEV;
}

for_each_child_of_node(of_channels, of_chan) {
for_each_child_of_node_scoped(of_channels, of_chan) {
ret = of_property_read_u32(of_chan, "reg", &reg);
if (!ret && (reg < ARRAY_SIZE(phy->tx_main_shift))) {
of_property_read_u64(of_chan,
Expand Down Expand Up @@ -4541,7 +4530,7 @@
return -ENODEV;
}

for_each_child_of_node(of_channels, of_chan) {
for_each_child_of_node_scoped(of_channels, of_chan) {
ret = of_property_read_u32(of_chan, "reg", &reg);
if (!ret && (reg < ARRAY_SIZE(phy->rx_fddc_shift))) {
u32 mode;
Expand Down Expand Up @@ -4610,7 +4599,7 @@
phy->ad9081.serdes_info.ser_settings.lane_settings[i].post_emp_setting =
lane_cfg[i];

for_each_child_of_node(of_channels, of_chan) {
for_each_child_of_node_scoped(of_channels, of_chan) {
ret = of_property_read_u32(of_chan, "reg", &reg);
if (!ret && (reg < ARRAY_SIZE(phy->jtx_link_rx))) {
ad9081_parse_jesd_link_dt(phy, of_chan,
Expand All @@ -4619,7 +4608,6 @@
dev_err(&phy->spi->dev,
"Missing or invalid reg property in rx jesd-links node (%d)\n",
reg);
of_node_put(of_chan);
break;
}
}
Expand Down Expand Up @@ -4899,7 +4887,7 @@
enum jesd204_state_op_reason reason,
struct jesd204_link *lnk)
{
struct device *dev = jesd204_dev_to_device(jdev);

Check warning on line 4890 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'dev' during its initialization is never read [deadcode.DeadStores] 4890 | struct device *dev = jesd204_dev_to_device(jdev); | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct ad9081_jesd204_priv *priv = jesd204_dev_priv(jdev);
struct ad9081_phy *phy = priv->phy;
struct ad9081_jesd_link *link;
Expand Down Expand Up @@ -5029,7 +5017,7 @@
enum jesd204_state_op_reason reason,
struct jesd204_link *lnk)
{
struct device *dev = jesd204_dev_to_device(jdev);

Check warning on line 5020 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'dev' during its initialization is never read [deadcode.DeadStores] 5020 | struct device *dev = jesd204_dev_to_device(jdev); | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct ad9081_jesd204_priv *priv = jesd204_dev_priv(jdev);
struct ad9081_phy *phy = priv->phy;
int ret;
Expand All @@ -5052,7 +5040,7 @@
enum jesd204_state_op_reason reason,
struct jesd204_link *lnk)
{
struct device *dev = jesd204_dev_to_device(jdev);

Check warning on line 5043 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'dev' during its initialization is never read [deadcode.DeadStores] 5043 | struct device *dev = jesd204_dev_to_device(jdev); | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct ad9081_jesd204_priv *priv = jesd204_dev_priv(jdev);
struct ad9081_phy *phy = priv->phy;
int ret;
Expand Down Expand Up @@ -5096,7 +5084,7 @@

static int ad9081_jesd204_uninit(struct jesd204_dev *jdev, enum jesd204_state_op_reason reason)
{
struct device *dev = jesd204_dev_to_device(jdev);

Check warning on line 5087 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'dev' during its initialization is never read [deadcode.DeadStores] 5087 | struct device *dev = jesd204_dev_to_device(jdev); | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

if (reason != JESD204_STATE_OP_REASON_UNINIT)
return JESD204_STATE_CHANGE_DONE;
Expand All @@ -5109,7 +5097,7 @@
static int ad9081_jesd204_setup_stage1(struct jesd204_dev *jdev,
enum jesd204_state_op_reason reason)
{
struct device *dev = jesd204_dev_to_device(jdev);

Check warning on line 5100 in drivers/iio/adc/ad9081.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'dev' during its initialization is never read [deadcode.DeadStores] 5100 | struct device *dev = jesd204_dev_to_device(jdev); | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct ad9081_jesd204_priv *priv = jesd204_dev_priv(jdev);
struct ad9081_phy *phy = priv->phy;
adi_cms_jesd_subclass_e subclass = JESD_SUBCLASS_0;
Expand Down
Loading