diff --git a/drivers/hwmon/peci/dimmtemp.c b/drivers/hwmon/peci/dimmtemp.c index c8222354c005..96b9919db357 100644 --- a/drivers/hwmon/peci/dimmtemp.c +++ b/drivers/hwmon/peci/dimmtemp.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -378,13 +379,6 @@ static void create_dimm_temp_info_delayed(struct work_struct *work) dev_err(priv->dev, "Failed to populate DIMM temp info\n"); } -static void remove_delayed_work(void *_priv) -{ - struct peci_dimmtemp *priv = _priv; - - cancel_delayed_work_sync(&priv->detect_work); -} - static int peci_dimmtemp_probe(struct auxiliary_device *adev, const struct auxiliary_device_id *id) { struct device *dev = &adev->dev; @@ -415,9 +409,8 @@ static int peci_dimmtemp_probe(struct auxiliary_device *adev, const struct auxil "Unexpected PECI revision %#x, some features may be unavailable\n", peci_dev->info.peci_revision); - INIT_DELAYED_WORK(&priv->detect_work, create_dimm_temp_info_delayed); - - ret = devm_add_action_or_reset(priv->dev, remove_delayed_work, priv); + ret = devm_delayed_work_autocancel(priv->dev, &priv->detect_work, + create_dimm_temp_info_delayed); if (ret) return ret;