bus.h (d200781ef237a354d918ceff5cee350d88a93d42) bus.h (730926c3b0998943654019f00296cf8e3b02277e)
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2016 - 2018 Intel Corporation. All rights reserved. */
3#ifndef __DAX_BUS_H__
4#define __DAX_BUS_H__
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2016 - 2018 Intel Corporation. All rights reserved. */
3#ifndef __DAX_BUS_H__
4#define __DAX_BUS_H__
5struct device;
5#include <linux/device.h>
6
6struct dev_dax;
7struct resource;
8struct dax_device;
9struct dax_region;
10void dax_region_put(struct dax_region *dax_region);
11struct dax_region *alloc_dax_region(struct device *parent, int region_id,
12 struct resource *res, unsigned int align, unsigned long flags);
7struct dev_dax;
8struct resource;
9struct dax_device;
10struct dax_region;
11void dax_region_put(struct dax_region *dax_region);
12struct dax_region *alloc_dax_region(struct device *parent, int region_id,
13 struct resource *res, unsigned int align, unsigned long flags);
13struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region, int id,
14 struct dev_pagemap *pgmap);
15
14
15enum dev_dax_subsys {
16 DEV_DAX_BUS,
17 DEV_DAX_CLASS,
18};
19
20struct dev_dax *__devm_create_dev_dax(struct dax_region *dax_region, int id,
21 struct dev_pagemap *pgmap, enum dev_dax_subsys subsys);
22
23static inline struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
24 int id, struct dev_pagemap *pgmap)
25{
26 return __devm_create_dev_dax(dax_region, id, pgmap, DEV_DAX_BUS);
27}
28
29/* to be deleted when DEV_DAX_CLASS is removed */
30struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys);
31
16struct dax_device_driver {
17 struct device_driver drv;
18 struct list_head ids;
19 int match_always;
20};
21
22int __dax_driver_register(struct dax_device_driver *dax_drv,
23 struct module *module, const char *mod_name);
24#define dax_driver_register(driver) \
25 __dax_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
26void dax_driver_unregister(struct dax_device_driver *dax_drv);
27void kill_dev_dax(struct dev_dax *dev_dax);
28
32struct dax_device_driver {
33 struct device_driver drv;
34 struct list_head ids;
35 int match_always;
36};
37
38int __dax_driver_register(struct dax_device_driver *dax_drv,
39 struct module *module, const char *mod_name);
40#define dax_driver_register(driver) \
41 __dax_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
42void dax_driver_unregister(struct dax_device_driver *dax_drv);
43void kill_dev_dax(struct dev_dax *dev_dax);
44
45#if IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)
46int dev_dax_probe(struct device *dev);
47#endif
48
29/*
30 * While run_dax() is potentially a generic operation that could be
31 * defined in include/linux/dax.h we don't want to grow any users
32 * outside of drivers/dax/
33 */
34void run_dax(struct dax_device *dax_dev);
35
36#define MODULE_ALIAS_DAX_DEVICE(type) \
37 MODULE_ALIAS("dax:t" __stringify(type) "*")
38#define DAX_DEVICE_MODALIAS_FMT "dax:t%d"
39
40#endif /* __DAX_BUS_H__ */
49/*
50 * While run_dax() is potentially a generic operation that could be
51 * defined in include/linux/dax.h we don't want to grow any users
52 * outside of drivers/dax/
53 */
54void run_dax(struct dax_device *dax_dev);
55
56#define MODULE_ALIAS_DAX_DEVICE(type) \
57 MODULE_ALIAS("dax:t" __stringify(type) "*")
58#define DAX_DEVICE_MODALIAS_FMT "dax:t%d"
59
60#endif /* __DAX_BUS_H__ */