extern struct spi_master *spi_busnum_to_master(u16 busnum);
- typedef void (*spi_res_release_t)(struct spi_master *master,
- struct spi_message *msg,
- void *res);
++++/*
++++ * SPI resource management while processing a SPI message
++++ */
++++
+ ++++typedef void (*spi_res_release_t)(struct spi_master *master,
+ ++++ struct spi_message *msg,
+ ++++ void *res);
+ ++++
++++/**
++++ * struct spi_res - spi resource management structure
++++ * @entry: list entry
++++ * @release: release code called prior to freeing this resource
++++ * @data: extra data allocated for the specific use-case
++++ *
++++ * this is based on ideas from devres, but focused on life-cycle
++++ * management during spi_message processing
++++ */
++++struct spi_res {
++++ struct list_head entry;
++++ spi_res_release_t release;
++++ unsigned long long data[]; /* guarantee ull alignment */
++++};
++++
++++extern void *spi_res_alloc(struct spi_device *spi,
++++ spi_res_release_t release,
++++ size_t size, gfp_t gfp);
++++extern void spi_res_add(struct spi_message *message, void *res);
++++extern void spi_res_free(void *res);
++++
++++extern void spi_res_release(struct spi_master *master,
++++ struct spi_message *message);
++++
/*---------------------------------------------------------------------------*/
/*