Skip to content

Commit ff985c7

Browse files
committed
auxbus: make to_auxiliary_drv accept and return a constant pointer
In the quest to make struct device constant, start by making to_auxiliary_drv() return a constant pointer so that drivers that call this can be fixed up before the driver core changes. As the return type previously was not constant, also fix up all callers that were assuming that the pointer was not going to be a constant one in order to not break the build. Cc: Dave Ertman <[email protected]> Cc: Ira Weiny <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Cc: Bingbu Cao <[email protected]> Cc: Tianshu Qiu <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Michael Chan <[email protected]> Cc: David S. Miller <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Jesse Brandeburg <[email protected]> Cc: Tony Nguyen <[email protected]> Cc: Saeed Mahameed <[email protected]> Cc: Leon Romanovsky <[email protected]> Cc: Tariq Toukan <[email protected]> Cc: Pierre-Louis Bossart <[email protected]> Cc: Liam Girdwood <[email protected]> Cc: Peter Ujfalusi <[email protected]> Cc: Bard Liao <[email protected]> Cc: Ranjani Sridharan <[email protected]> Cc: Daniel Baluta <[email protected]> Cc: Kai Vehmanen <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Richard Cochran <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Acked-by: Sakari Ailus <[email protected]> # drivers/media/pci/intel/ipu6 Acked-by: Mark Brown <[email protected]> Reviewed-by: Martin Habets <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 477e365 commit ff985c7

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

drivers/base/auxiliary.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static const struct auxiliary_device_id *auxiliary_match_id(const struct auxilia
180180
static int auxiliary_match(struct device *dev, struct device_driver *drv)
181181
{
182182
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
183-
struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv);
183+
const struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv);
184184

185185
return !!auxiliary_match_id(auxdrv->id_table, auxdev);
186186
}
@@ -203,7 +203,7 @@ static const struct dev_pm_ops auxiliary_dev_pm_ops = {
203203

204204
static int auxiliary_bus_probe(struct device *dev)
205205
{
206-
struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
206+
const struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
207207
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
208208
int ret;
209209

@@ -222,7 +222,7 @@ static int auxiliary_bus_probe(struct device *dev)
222222

223223
static void auxiliary_bus_remove(struct device *dev)
224224
{
225-
struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
225+
const struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
226226
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
227227

228228
if (auxdrv->remove)
@@ -232,7 +232,7 @@ static void auxiliary_bus_remove(struct device *dev)
232232

233233
static void auxiliary_bus_shutdown(struct device *dev)
234234
{
235-
struct auxiliary_driver *auxdrv = NULL;
235+
const struct auxiliary_driver *auxdrv = NULL;
236236
struct auxiliary_device *auxdev;
237237

238238
if (dev->driver) {

drivers/media/pci/intel/ipu6/ipu6-bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct ipu6_buttress_ctrl;
2121

2222
struct ipu6_bus_device {
2323
struct auxiliary_device auxdev;
24-
struct auxiliary_driver *auxdrv;
24+
const struct auxiliary_driver *auxdrv;
2525
const struct ipu6_auxdrv_data *auxdrv_data;
2626
struct list_head list;
2727
void *pdata;

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void bnxt_ulp_stop(struct bnxt *bp)
239239

240240
adev = &aux_priv->aux_dev;
241241
if (adev->dev.driver) {
242-
struct auxiliary_driver *adrv;
242+
const struct auxiliary_driver *adrv;
243243
pm_message_t pm = {};
244244

245245
adrv = to_auxiliary_drv(adev->dev.driver);
@@ -277,7 +277,7 @@ void bnxt_ulp_start(struct bnxt *bp, int err)
277277

278278
adev = &aux_priv->aux_dev;
279279
if (adev->dev.driver) {
280-
struct auxiliary_driver *adrv;
280+
const struct auxiliary_driver *adrv;
281281

282282
adrv = to_auxiliary_drv(adev->dev.driver);
283283
edev->en_state = bp->state;

drivers/net/ethernet/intel/ice/ice_ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2784,7 +2784,7 @@ static struct ice_pf *
27842784
ice_ptp_aux_dev_to_owner_pf(struct auxiliary_device *aux_dev)
27852785
{
27862786
struct ice_ptp_port_owner *ports_owner;
2787-
struct auxiliary_driver *aux_drv;
2787+
const struct auxiliary_driver *aux_drv;
27882788
struct ice_ptp *owner_ptp;
27892789

27902790
if (!aux_dev->dev.driver)

drivers/net/ethernet/mellanox/mlx5/core/dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ int mlx5_attach_device(struct mlx5_core_dev *dev)
349349
{
350350
struct mlx5_priv *priv = &dev->priv;
351351
struct auxiliary_device *adev;
352-
struct auxiliary_driver *adrv;
352+
const struct auxiliary_driver *adrv;
353353
int ret = 0, i;
354354

355355
devl_assert_locked(priv_to_devlink(dev));
@@ -406,7 +406,7 @@ void mlx5_detach_device(struct mlx5_core_dev *dev, bool suspend)
406406
{
407407
struct mlx5_priv *priv = &dev->priv;
408408
struct auxiliary_device *adev;
409-
struct auxiliary_driver *adrv;
409+
const struct auxiliary_driver *adrv;
410410
pm_message_t pm = {};
411411
int i;
412412

include/linux/auxiliary_bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static inline struct auxiliary_device *to_auxiliary_dev(struct device *dev)
203203
return container_of(dev, struct auxiliary_device, dev);
204204
}
205205

206-
static inline struct auxiliary_driver *to_auxiliary_drv(struct device_driver *drv)
206+
static inline const struct auxiliary_driver *to_auxiliary_drv(const struct device_driver *drv)
207207
{
208208
return container_of(drv, struct auxiliary_driver, driver);
209209
}

sound/soc/sof/sof-client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ EXPORT_SYMBOL_NS_GPL(sof_client_ipc4_find_module, SND_SOC_SOF_CLIENT);
357357

358358
int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state)
359359
{
360-
struct auxiliary_driver *adrv;
360+
const struct auxiliary_driver *adrv;
361361
struct sof_client_dev *cdev;
362362

363363
mutex_lock(&sdev->ipc_client_mutex);
@@ -380,7 +380,7 @@ EXPORT_SYMBOL_NS_GPL(sof_suspend_clients, SND_SOC_SOF_CLIENT);
380380

381381
int sof_resume_clients(struct snd_sof_dev *sdev)
382382
{
383-
struct auxiliary_driver *adrv;
383+
const struct auxiliary_driver *adrv;
384384
struct sof_client_dev *cdev;
385385

386386
mutex_lock(&sdev->ipc_client_mutex);

0 commit comments

Comments
 (0)