Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mfd-fixes-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD fixes from Lee Jones:
"Contained are some standard fixes and unusually an extension to the
Reset API. Some of those changes are required to fix a bug introduced
in -rc1, which introduces extra 'reset line checks' i.e. whether the
line is shared or not. If a line is shared and the new *_shared() API
is not used, the request fails with an error. This breaks USB in v4.7
for ST's platforms.

Admittedly, there are some patches contained in our (MFD/Reset)
immutable branch which are not true -fixes, but there isn't anything I
can do about that. Rest assured though, there aren't any API
'changes'. Everything is the same from the consumer's perspective.

- Use new reset_*_get_shared() variant to prevent reset line
obtainment failure (Fixes commit 0b52297f2288: "reset: Add support
for shared reset controls")

- Fix unintentional switch() fall-through into error path

- Fix uninitialised variable compiler warning"

* tag 'mfd-fixes-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
mfd: da9053: Fix compiler warning message for uninitialised variable
mfd: max77620: Fix FPS switch statements
phy: phy-stih407-usb: Inform the reset framework that our reset line may be shared
usb: dwc3: st: Inform the reset framework that our reset line may be shared
usb: host: ehci-st: Inform the reset framework that our reset line may be shared
usb: host: ohci-st: Inform the reset framework that our reset line may be shared
reset: TRIVIAL: Add line break at same place for similar APIs
reset: Supply *_shared variant calls when using *_optional APIs
reset: Supply *_shared variant calls when using of_* API
reset: Ensure drivers are explicit when requesting reset lines
reset: Reorder inline reset_control_get*() wrappers

+182 -52
+2
drivers/mfd/max77620.c
··· 203 203 break; 204 204 case MAX77620: 205 205 fps_min_period = MAX77620_FPS_PERIOD_MIN_US; 206 + break; 206 207 default: 207 208 return -EINVAL; 208 209 } ··· 237 236 break; 238 237 case MAX77620: 239 238 fps_max_period = MAX77620_FPS_PERIOD_MAX_US; 239 + break; 240 240 default: 241 241 return -EINVAL; 242 242 }
+1 -1
drivers/phy/phy-stih407-usb.c
··· 105 105 phy_dev->dev = dev; 106 106 dev_set_drvdata(dev, phy_dev); 107 107 108 - phy_dev->rstc = devm_reset_control_get(dev, "global"); 108 + phy_dev->rstc = devm_reset_control_get_shared(dev, "global"); 109 109 if (IS_ERR(phy_dev->rstc)) { 110 110 dev_err(dev, "failed to ctrl picoPHY reset\n"); 111 111 return PTR_ERR(phy_dev->rstc);
+2 -1
drivers/usb/dwc3/dwc3-st.c
··· 243 243 /* Manage PowerDown */ 244 244 reset_control_deassert(dwc3_data->rstc_pwrdn); 245 245 246 - dwc3_data->rstc_rst = devm_reset_control_get(dev, "softreset"); 246 + dwc3_data->rstc_rst = 247 + devm_reset_control_get_shared(dev, "softreset"); 247 248 if (IS_ERR(dwc3_data->rstc_rst)) { 248 249 dev_err(&pdev->dev, "could not get reset controller\n"); 249 250 ret = PTR_ERR(dwc3_data->rstc_rst);
+4 -2
drivers/usb/host/ehci-st.c
··· 206 206 priv->clk48 = NULL; 207 207 } 208 208 209 - priv->pwr = devm_reset_control_get_optional(&dev->dev, "power"); 209 + priv->pwr = 210 + devm_reset_control_get_optional_shared(&dev->dev, "power"); 210 211 if (IS_ERR(priv->pwr)) { 211 212 err = PTR_ERR(priv->pwr); 212 213 if (err == -EPROBE_DEFER) ··· 215 214 priv->pwr = NULL; 216 215 } 217 216 218 - priv->rst = devm_reset_control_get_optional(&dev->dev, "softreset"); 217 + priv->rst = 218 + devm_reset_control_get_optional_shared(&dev->dev, "softreset"); 219 219 if (IS_ERR(priv->rst)) { 220 220 err = PTR_ERR(priv->rst); 221 221 if (err == -EPROBE_DEFER)
+4 -2
drivers/usb/host/ohci-st.c
··· 188 188 priv->clk48 = NULL; 189 189 } 190 190 191 - priv->pwr = devm_reset_control_get_optional(&dev->dev, "power"); 191 + priv->pwr = 192 + devm_reset_control_get_optional_shared(&dev->dev, "power"); 192 193 if (IS_ERR(priv->pwr)) { 193 194 err = PTR_ERR(priv->pwr); 194 195 goto err_put_clks; 195 196 } 196 197 197 - priv->rst = devm_reset_control_get_optional(&dev->dev, "softreset"); 198 + priv->rst = 199 + devm_reset_control_get_optional_shared(&dev->dev, "softreset"); 198 200 if (IS_ERR(priv->rst)) { 199 201 err = PTR_ERR(priv->rst); 200 202 goto err_put_clks;
+1 -1
include/linux/mfd/da9052/da9052.h
··· 171 171 static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg, 172 172 unsigned reg_cnt, unsigned char *val) 173 173 { 174 - int ret; 174 + int ret = 0; 175 175 int i; 176 176 177 177 for (i = 0; i < reg_cnt; i++) {
+168 -45
include/linux/reset.h
··· 84 84 #endif /* CONFIG_RESET_CONTROLLER */ 85 85 86 86 /** 87 - * reset_control_get - Lookup and obtain an exclusive reference to a 88 - * reset controller. 87 + * reset_control_get_exclusive - Lookup and obtain an exclusive reference 88 + * to a reset controller. 89 89 * @dev: device to be reset by the controller 90 90 * @id: reset line name 91 91 * ··· 98 98 * 99 99 * Use of id names is optional. 100 100 */ 101 - static inline struct reset_control *__must_check reset_control_get( 102 - struct device *dev, const char *id) 101 + static inline struct reset_control * 102 + __must_check reset_control_get_exclusive(struct device *dev, const char *id) 103 103 { 104 104 #ifndef CONFIG_RESET_CONTROLLER 105 105 WARN_ON(1); 106 106 #endif 107 - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); 108 - } 109 - 110 - static inline struct reset_control *reset_control_get_optional( 111 - struct device *dev, const char *id) 112 - { 113 107 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); 114 108 } 115 109 ··· 135 141 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1); 136 142 } 137 143 144 + static inline struct reset_control *reset_control_get_optional_exclusive( 145 + struct device *dev, const char *id) 146 + { 147 + return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); 148 + } 149 + 150 + static inline struct reset_control *reset_control_get_optional_shared( 151 + struct device *dev, const char *id) 152 + { 153 + return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1); 154 + } 155 + 138 156 /** 139 - * of_reset_control_get - Lookup and obtain an exclusive reference to a 140 - * reset controller. 157 + * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference 158 + * to a reset controller. 141 159 * @node: device to be reset by the controller 142 160 * @id: reset line name 143 161 * ··· 157 151 * 158 152 * Use of id names is optional. 159 153 */ 160 - static inline struct reset_control *of_reset_control_get( 154 + static inline struct reset_control *of_reset_control_get_exclusive( 161 155 struct device_node *node, const char *id) 162 156 { 163 157 return __of_reset_control_get(node, id, 0, 0); 164 158 } 165 159 166 160 /** 167 - * of_reset_control_get_by_index - Lookup and obtain an exclusive reference to 168 - * a reset controller by index. 161 + * of_reset_control_get_shared - Lookup and obtain an shared reference 162 + * to a reset controller. 163 + * @node: device to be reset by the controller 164 + * @id: reset line name 165 + * 166 + * When a reset-control is shared, the behavior of reset_control_assert / 167 + * deassert is changed, the reset-core will keep track of a deassert_count 168 + * and only (re-)assert the reset after reset_control_assert has been called 169 + * as many times as reset_control_deassert was called. Also see the remark 170 + * about shared reset-controls in the reset_control_assert docs. 171 + * 172 + * Calling reset_control_assert without first calling reset_control_deassert 173 + * is not allowed on a shared reset control. Calling reset_control_reset is 174 + * also not allowed on a shared reset control. 175 + * Returns a struct reset_control or IS_ERR() condition containing errno. 176 + * 177 + * Use of id names is optional. 178 + */ 179 + static inline struct reset_control *of_reset_control_get_shared( 180 + struct device_node *node, const char *id) 181 + { 182 + return __of_reset_control_get(node, id, 0, 1); 183 + } 184 + 185 + /** 186 + * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive 187 + * reference to a reset controller 188 + * by index. 169 189 * @node: device to be reset by the controller 170 190 * @index: index of the reset controller 171 191 * ··· 199 167 * in whatever order. Returns a struct reset_control or IS_ERR() condition 200 168 * containing errno. 201 169 */ 202 - static inline struct reset_control *of_reset_control_get_by_index( 170 + static inline struct reset_control *of_reset_control_get_exclusive_by_index( 203 171 struct device_node *node, int index) 204 172 { 205 173 return __of_reset_control_get(node, NULL, index, 0); 206 174 } 207 175 208 176 /** 209 - * devm_reset_control_get - resource managed reset_control_get() 177 + * of_reset_control_get_shared_by_index - Lookup and obtain an shared 178 + * reference to a reset controller 179 + * by index. 180 + * @node: device to be reset by the controller 181 + * @index: index of the reset controller 182 + * 183 + * When a reset-control is shared, the behavior of reset_control_assert / 184 + * deassert is changed, the reset-core will keep track of a deassert_count 185 + * and only (re-)assert the reset after reset_control_assert has been called 186 + * as many times as reset_control_deassert was called. Also see the remark 187 + * about shared reset-controls in the reset_control_assert docs. 188 + * 189 + * Calling reset_control_assert without first calling reset_control_deassert 190 + * is not allowed on a shared reset control. Calling reset_control_reset is 191 + * also not allowed on a shared reset control. 192 + * Returns a struct reset_control or IS_ERR() condition containing errno. 193 + * 194 + * This is to be used to perform a list of resets for a device or power domain 195 + * in whatever order. Returns a struct reset_control or IS_ERR() condition 196 + * containing errno. 197 + */ 198 + static inline struct reset_control *of_reset_control_get_shared_by_index( 199 + struct device_node *node, int index) 200 + { 201 + return __of_reset_control_get(node, NULL, index, 1); 202 + } 203 + 204 + /** 205 + * devm_reset_control_get_exclusive - resource managed 206 + * reset_control_get_exclusive() 210 207 * @dev: device to be reset by the controller 211 208 * @id: reset line name 212 209 * 213 - * Managed reset_control_get(). For reset controllers returned from this 214 - * function, reset_control_put() is called automatically on driver detach. 215 - * See reset_control_get() for more information. 210 + * Managed reset_control_get_exclusive(). For reset controllers returned 211 + * from this function, reset_control_put() is called automatically on driver 212 + * detach. 213 + * 214 + * See reset_control_get_exclusive() for more information. 216 215 */ 217 - static inline struct reset_control *__must_check devm_reset_control_get( 218 - struct device *dev, const char *id) 216 + static inline struct reset_control * 217 + __must_check devm_reset_control_get_exclusive(struct device *dev, 218 + const char *id) 219 219 { 220 220 #ifndef CONFIG_RESET_CONTROLLER 221 221 WARN_ON(1); 222 222 #endif 223 223 return __devm_reset_control_get(dev, id, 0, 0); 224 - } 225 - 226 - static inline struct reset_control *devm_reset_control_get_optional( 227 - struct device *dev, const char *id) 228 - { 229 - return __devm_reset_control_get(dev, id, 0, 0); 230 - } 231 - 232 - /** 233 - * devm_reset_control_get_by_index - resource managed reset_control_get 234 - * @dev: device to be reset by the controller 235 - * @index: index of the reset controller 236 - * 237 - * Managed reset_control_get(). For reset controllers returned from this 238 - * function, reset_control_put() is called automatically on driver detach. 239 - * See reset_control_get() for more information. 240 - */ 241 - static inline struct reset_control *devm_reset_control_get_by_index( 242 - struct device *dev, int index) 243 - { 244 - return __devm_reset_control_get(dev, NULL, index, 0); 245 224 } 246 225 247 226 /** ··· 270 227 return __devm_reset_control_get(dev, id, 0, 1); 271 228 } 272 229 230 + static inline struct reset_control *devm_reset_control_get_optional_exclusive( 231 + struct device *dev, const char *id) 232 + { 233 + return __devm_reset_control_get(dev, id, 0, 0); 234 + } 235 + 236 + static inline struct reset_control *devm_reset_control_get_optional_shared( 237 + struct device *dev, const char *id) 238 + { 239 + return __devm_reset_control_get(dev, id, 0, 1); 240 + } 241 + 242 + /** 243 + * devm_reset_control_get_exclusive_by_index - resource managed 244 + * reset_control_get_exclusive() 245 + * @dev: device to be reset by the controller 246 + * @index: index of the reset controller 247 + * 248 + * Managed reset_control_get_exclusive(). For reset controllers returned from 249 + * this function, reset_control_put() is called automatically on driver 250 + * detach. 251 + * 252 + * See reset_control_get_exclusive() for more information. 253 + */ 254 + static inline struct reset_control * 255 + devm_reset_control_get_exclusive_by_index(struct device *dev, int index) 256 + { 257 + return __devm_reset_control_get(dev, NULL, index, 0); 258 + } 259 + 273 260 /** 274 261 * devm_reset_control_get_shared_by_index - resource managed 275 262 * reset_control_get_shared ··· 310 237 * this function, reset_control_put() is called automatically on driver detach. 311 238 * See reset_control_get_shared() for more information. 312 239 */ 313 - static inline struct reset_control *devm_reset_control_get_shared_by_index( 314 - struct device *dev, int index) 240 + static inline struct reset_control * 241 + devm_reset_control_get_shared_by_index(struct device *dev, int index) 315 242 { 316 243 return __devm_reset_control_get(dev, NULL, index, 1); 317 244 } 318 245 246 + /* 247 + * TEMPORARY calls to use during transition: 248 + * 249 + * of_reset_control_get() => of_reset_control_get_exclusive() 250 + * 251 + * These inline function calls will be removed once all consumers 252 + * have been moved over to the new explicit API. 253 + */ 254 + static inline struct reset_control *reset_control_get( 255 + struct device *dev, const char *id) 256 + { 257 + return reset_control_get_exclusive(dev, id); 258 + } 259 + 260 + static inline struct reset_control *reset_control_get_optional( 261 + struct device *dev, const char *id) 262 + { 263 + return reset_control_get_optional_exclusive(dev, id); 264 + } 265 + 266 + static inline struct reset_control *of_reset_control_get( 267 + struct device_node *node, const char *id) 268 + { 269 + return of_reset_control_get_exclusive(node, id); 270 + } 271 + 272 + static inline struct reset_control *of_reset_control_get_by_index( 273 + struct device_node *node, int index) 274 + { 275 + return of_reset_control_get_exclusive_by_index(node, index); 276 + } 277 + 278 + static inline struct reset_control *devm_reset_control_get( 279 + struct device *dev, const char *id) 280 + { 281 + return devm_reset_control_get_exclusive(dev, id); 282 + } 283 + 284 + static inline struct reset_control *devm_reset_control_get_optional( 285 + struct device *dev, const char *id) 286 + { 287 + return devm_reset_control_get_optional_exclusive(dev, id); 288 + 289 + } 290 + 291 + static inline struct reset_control *devm_reset_control_get_by_index( 292 + struct device *dev, int index) 293 + { 294 + return devm_reset_control_get_exclusive_by_index(dev, index); 295 + } 319 296 #endif