mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
Merge branch 'for-5.12/dax' into for-5.12/libnvdimm
Pick up device-dax updates to merge with libnvdimm device updates for 5.12. * Fix the polarity of EINVAL in a sysfs return code * Drop the unused return code for driver remove() callbacks
This commit is contained in:
@@ -179,7 +179,10 @@ static int dax_bus_remove(struct device *dev)
|
|||||||
struct dax_device_driver *dax_drv = to_dax_drv(dev->driver);
|
struct dax_device_driver *dax_drv = to_dax_drv(dev->driver);
|
||||||
struct dev_dax *dev_dax = to_dev_dax(dev);
|
struct dev_dax *dev_dax = to_dev_dax(dev);
|
||||||
|
|
||||||
return dax_drv->remove(dev_dax);
|
if (dax_drv->remove)
|
||||||
|
dax_drv->remove(dev_dax);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bus_type dax_bus_type = {
|
static struct bus_type dax_bus_type = {
|
||||||
@@ -1038,7 +1041,7 @@ static ssize_t range_parse(const char *opt, size_t len, struct range *range)
|
|||||||
{
|
{
|
||||||
unsigned long long addr = 0;
|
unsigned long long addr = 0;
|
||||||
char *start, *end, *str;
|
char *start, *end, *str;
|
||||||
ssize_t rc = EINVAL;
|
ssize_t rc = -EINVAL;
|
||||||
|
|
||||||
str = kstrdup(opt, GFP_KERNEL);
|
str = kstrdup(opt, GFP_KERNEL);
|
||||||
if (!str)
|
if (!str)
|
||||||
@@ -1392,6 +1395,13 @@ int __dax_driver_register(struct dax_device_driver *dax_drv,
|
|||||||
struct device_driver *drv = &dax_drv->drv;
|
struct device_driver *drv = &dax_drv->drv;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dax_bus_probe() calls dax_drv->probe() unconditionally.
|
||||||
|
* So better be safe than sorry and ensure it is provided.
|
||||||
|
*/
|
||||||
|
if (!dax_drv->probe)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&dax_drv->ids);
|
INIT_LIST_HEAD(&dax_drv->ids);
|
||||||
drv->owner = module;
|
drv->owner = module;
|
||||||
drv->name = mod_name;
|
drv->name = mod_name;
|
||||||
@@ -1409,7 +1419,15 @@ int __dax_driver_register(struct dax_device_driver *dax_drv,
|
|||||||
mutex_unlock(&dax_bus_lock);
|
mutex_unlock(&dax_bus_lock);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
return driver_register(drv);
|
|
||||||
|
rc = driver_register(drv);
|
||||||
|
if (rc && dax_drv->match_always) {
|
||||||
|
mutex_lock(&dax_bus_lock);
|
||||||
|
match_always_count -= dax_drv->match_always;
|
||||||
|
mutex_unlock(&dax_bus_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(__dax_driver_register);
|
EXPORT_SYMBOL_GPL(__dax_driver_register);
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ struct dax_device_driver {
|
|||||||
struct list_head ids;
|
struct list_head ids;
|
||||||
int match_always;
|
int match_always;
|
||||||
int (*probe)(struct dev_dax *dev);
|
int (*probe)(struct dev_dax *dev);
|
||||||
int (*remove)(struct dev_dax *dev);
|
void (*remove)(struct dev_dax *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
int __dax_driver_register(struct dax_device_driver *dax_drv,
|
int __dax_driver_register(struct dax_device_driver *dax_drv,
|
||||||
|
@@ -452,15 +452,9 @@ int dev_dax_probe(struct dev_dax *dev_dax)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dev_dax_probe);
|
EXPORT_SYMBOL_GPL(dev_dax_probe);
|
||||||
|
|
||||||
static int dev_dax_remove(struct dev_dax *dev_dax)
|
|
||||||
{
|
|
||||||
/* all probe actions are unwound by devm */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct dax_device_driver device_dax_driver = {
|
static struct dax_device_driver device_dax_driver = {
|
||||||
.probe = dev_dax_probe,
|
.probe = dev_dax_probe,
|
||||||
.remove = dev_dax_remove,
|
/* all probe actions are unwound by devm, so .remove isn't necessary */
|
||||||
.match_always = 1,
|
.match_always = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -136,7 +136,7 @@ err_res_name:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MEMORY_HOTREMOVE
|
#ifdef CONFIG_MEMORY_HOTREMOVE
|
||||||
static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
|
static void dev_dax_kmem_remove(struct dev_dax *dev_dax)
|
||||||
{
|
{
|
||||||
int i, success = 0;
|
int i, success = 0;
|
||||||
struct device *dev = &dev_dax->dev;
|
struct device *dev = &dev_dax->dev;
|
||||||
@@ -176,11 +176,9 @@ static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
|
|||||||
kfree(data);
|
kfree(data);
|
||||||
dev_set_drvdata(dev, NULL);
|
dev_set_drvdata(dev, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
|
static void dev_dax_kmem_remove(struct dev_dax *dev_dax)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Without hotremove purposely leak the request_mem_region() for the
|
* Without hotremove purposely leak the request_mem_region() for the
|
||||||
@@ -190,7 +188,6 @@ static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
|
|||||||
* request_mem_region().
|
* request_mem_region().
|
||||||
*/
|
*/
|
||||||
any_hotremove_failed = true;
|
any_hotremove_failed = true;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_MEMORY_HOTREMOVE */
|
#endif /* CONFIG_MEMORY_HOTREMOVE */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user