Skip to content

Commit bcf003b

Browse files
committed
Merge tag 'phy-fixes-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy into char-misc-next
Vinod writes: phy: fixes for 5.8 *) Fix for intel combo driver for warns or errors *) Constify symbols for am654-serdes & j721e-wiz *) Return value fix for rockchip driver *) Null pointer dereference fix for sun4i-usb * tag 'phy-fixes-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: phy: sun4i-usb: fix dereference of pointer phy0 before it is null checked phy: rockchip: Fix return value of inno_dsidphy_probe() phy: ti: j721e-wiz: Constify structs phy: ti: am654-serdes: Constify regmap_config phy: intel: fix enum type mismatch warning phy: intel: Fix compilation error on FIELD_PREP usage
2 parents 76ea60f + 38b1927 commit bcf003b

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

drivers/phy/allwinner/phy-sun4i-usb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,13 +545,14 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
545545
struct sun4i_usb_phy_data *data =
546546
container_of(work, struct sun4i_usb_phy_data, detect.work);
547547
struct phy *phy0 = data->phys[0].phy;
548-
struct sun4i_usb_phy *phy = phy_get_drvdata(phy0);
548+
struct sun4i_usb_phy *phy;
549549
bool force_session_end, id_notify = false, vbus_notify = false;
550550
int id_det, vbus_det;
551551

552-
if (phy0 == NULL)
552+
if (!phy0)
553553
return;
554554

555+
phy = phy_get_drvdata(phy0);
555556
id_det = sun4i_usb_phy0_get_id_det(data);
556557
vbus_det = sun4i_usb_phy0_get_vbus_det(data);
557558

drivers/phy/intel/phy-intel-combo.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static inline void combo_phy_w32_off_mask(void __iomem *base, unsigned int reg,
134134

135135
reg_val = readl(base + reg);
136136
reg_val &= ~mask;
137-
reg_val |= FIELD_PREP(mask, val);
137+
reg_val |= val;
138138
writel(reg_val, base + reg);
139139
}
140140

@@ -169,7 +169,7 @@ static int intel_cbphy_pcie_en_pad_refclk(struct intel_cbphy_iphy *iphy)
169169
return 0;
170170

171171
combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL,
172-
PCIE_PHY_CLK_PAD, 0);
172+
PCIE_PHY_CLK_PAD, FIELD_PREP(PCIE_PHY_CLK_PAD, 0));
173173

174174
/* Delay for stable clock PLL */
175175
usleep_range(50, 100);
@@ -192,14 +192,14 @@ static int intel_cbphy_pcie_dis_pad_refclk(struct intel_cbphy_iphy *iphy)
192192
return 0;
193193

194194
combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL,
195-
PCIE_PHY_CLK_PAD, 1);
195+
PCIE_PHY_CLK_PAD, FIELD_PREP(PCIE_PHY_CLK_PAD, 1));
196196

197197
return 0;
198198
}
199199

200200
static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy)
201201
{
202-
enum intel_combo_mode cb_mode = PHY_PCIE_MODE;
202+
enum intel_combo_mode cb_mode;
203203
enum aggregated_mode aggr = cbphy->aggr_mode;
204204
struct device *dev = cbphy->dev;
205205
enum intel_phy_mode mode;
@@ -224,6 +224,8 @@ static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy)
224224

225225
cb_mode = SATA0_SATA1_MODE;
226226
break;
227+
default:
228+
return -EINVAL;
227229
}
228230

229231
ret = regmap_write(cbphy->hsiocfg, REG_COMBO_MODE(cbphy->bid), cb_mode);
@@ -385,7 +387,7 @@ static int intel_cbphy_calibrate(struct phy *phy)
385387

386388
/* trigger auto RX adaptation */
387389
combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id),
388-
ADAPT_REQ_MSK, 3);
390+
ADAPT_REQ_MSK, FIELD_PREP(ADAPT_REQ_MSK, 3));
389391
/* Wait RX adaptation to finish */
390392
ret = readl_poll_timeout(cr_base + CR_ADDR(PCS_XF_RX_ADAPT_ACK, id),
391393
val, val & RX_ADAPT_ACK_BIT, 10, 5000);
@@ -396,7 +398,7 @@ static int intel_cbphy_calibrate(struct phy *phy)
396398

397399
/* Stop RX adaptation */
398400
combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id),
399-
ADAPT_REQ_MSK, 0);
401+
ADAPT_REQ_MSK, FIELD_PREP(ADAPT_REQ_MSK, 0));
400402

401403
return ret;
402404
}

drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ static int inno_dsidphy_probe(struct platform_device *pdev)
607607
platform_set_drvdata(pdev, inno);
608608

609609
inno->phy_base = devm_platform_ioremap_resource(pdev, 0);
610-
if (!inno->phy_base)
611-
return -ENOMEM;
610+
if (IS_ERR(inno->phy_base))
611+
return PTR_ERR(inno->phy_base);
612612

613613
inno->ref_clk = devm_clk_get(dev, "ref");
614614
if (IS_ERR(inno->ref_clk)) {

drivers/phy/ti/phy-am654-serdes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct serdes_am654_clk_mux {
7272
#define to_serdes_am654_clk_mux(_hw) \
7373
container_of(_hw, struct serdes_am654_clk_mux, hw)
7474

75-
static struct regmap_config serdes_am654_regmap_config = {
75+
static const struct regmap_config serdes_am654_regmap_config = {
7676
.reg_bits = 32,
7777
.val_bits = 32,
7878
.reg_stride = 4,

drivers/phy/ti/phy-j721e-wiz.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ struct wiz_clk_mux {
117117
struct wiz_clk_divider {
118118
struct clk_hw hw;
119119
struct regmap_field *field;
120-
struct clk_div_table *table;
120+
const struct clk_div_table *table;
121121
struct clk_init_data clk_data;
122122
};
123123

@@ -131,7 +131,7 @@ struct wiz_clk_mux_sel {
131131

132132
struct wiz_clk_div_sel {
133133
struct regmap_field *field;
134-
struct clk_div_table *table;
134+
const struct clk_div_table *table;
135135
const char *node_name;
136136
};
137137

@@ -173,7 +173,7 @@ static struct wiz_clk_mux_sel clk_mux_sel_10g[] = {
173173
},
174174
};
175175

176-
static struct clk_div_table clk_div_table[] = {
176+
static const struct clk_div_table clk_div_table[] = {
177177
{ .val = 0, .div = 1, },
178178
{ .val = 1, .div = 2, },
179179
{ .val = 2, .div = 4, },
@@ -559,7 +559,7 @@ static const struct clk_ops wiz_clk_div_ops = {
559559

560560
static int wiz_div_clk_register(struct wiz *wiz, struct device_node *node,
561561
struct regmap_field *field,
562-
struct clk_div_table *table)
562+
const struct clk_div_table *table)
563563
{
564564
struct device *dev = wiz->dev;
565565
struct wiz_clk_divider *div;
@@ -756,7 +756,7 @@ static const struct reset_control_ops wiz_phy_reset_ops = {
756756
.deassert = wiz_phy_reset_deassert,
757757
};
758758

759-
static struct regmap_config wiz_regmap_config = {
759+
static const struct regmap_config wiz_regmap_config = {
760760
.reg_bits = 32,
761761
.val_bits = 32,
762762
.reg_stride = 4,

0 commit comments

Comments
 (0)