fpga: bridge: Use standard dev_release for class driver

The FPGA bridge class driver data structure is being treated as a
managed resource instead of using the standard dev_release call-back
function to release the class data structure. This change removes
the managed resource code and combines the create() and register()
functions into a single register() function.

Signed-off-by: Russ Weight <russell.h.weight@intel.com>
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
This commit is contained in:
Russ Weight 2021-11-18 17:55:52 -08:00 committed by Moritz Fischer
parent 4ba0b2c294
commit 0d70af3c25
8 changed files with 74 additions and 145 deletions

View file

@ -22,6 +22,23 @@ struct fpga_bridge_ops {
const struct attribute_group **groups;
};
/**
* struct fpga_bridge_info - collection of parameters an FPGA Bridge
* @name: fpga bridge name
* @br_ops: pointer to structure of fpga bridge ops
* @priv: fpga bridge private data
*
* fpga_bridge_info contains parameters for the register function. These
* are separated into an info structure because they some are optional
* others could be added to in the future. The info structure facilitates
* maintaining a stable API.
*/
struct fpga_bridge_info {
const char *name;
const struct fpga_bridge_ops *br_ops;
void *priv;
};
/**
* struct fpga_bridge - FPGA bridge structure
* @name: name of low level FPGA bridge
@ -62,15 +79,10 @@ int of_fpga_bridge_get_to_list(struct device_node *np,
struct fpga_image_info *info,
struct list_head *bridge_list);
struct fpga_bridge *fpga_bridge_create(struct device *dev, const char *name,
const struct fpga_bridge_ops *br_ops,
void *priv);
void fpga_bridge_free(struct fpga_bridge *br);
int fpga_bridge_register(struct fpga_bridge *br);
struct fpga_bridge *
fpga_bridge_register(struct device *parent, const char *name,
const struct fpga_bridge_ops *br_ops,
void *priv);
void fpga_bridge_unregister(struct fpga_bridge *br);
struct fpga_bridge
*devm_fpga_bridge_create(struct device *dev, const char *name,
const struct fpga_bridge_ops *br_ops, void *priv);
#endif /* _LINUX_FPGA_BRIDGE_H */