On Tue, 13 Feb 2024 10:22:45 +0000 Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> wrote: > On Mon, 12 Feb 2024 12:58:03 +0000 > Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> wrote: > > > On Mon, Feb 12, 2024 at 02:46:49PM +0200, Andy Shevchenko wrote: > > > On Mon, Feb 12, 2024 at 12:36:46PM +0000, Sakari Ailus wrote: > > > > On Mon, Feb 12, 2024 at 11:42:06AM +0000, Jonathan Cameron wrote: > > > > > > ... > > > > > > > Hmm. In that case I'd rather make fwnode_handle_put() and similar trivial > > > > functions macros. > > > > > > This will kill the type-checking opportunity, so I'm against this move. > > > > Then it could be made static inline and moved to the header. I suppose for > > modern compilers there should be no difference in between the two > > optimisation-wise. > > > > Sure - will be a bit fiddly as this is only worth doing if we drop > the internal check that buried several macros deep. Not enough coffee yesterday. We can just move the the existing fwnode_handle_put() to property.h as that includes fwnode.h has all the definitions in it which we need to be able to see. I think that should be uncontroversial? Jonathan > > 1. rename existing fwnode_handle_put() to __fwnode_handle_put() > 2. Make __fwnode_handle_put() call a new set of macros > #define fwnode_has_op_nocheck(fwnode, op) \ > (fwnode)->ops && (fwnode)->ops->op > > #define fwnode_call_void_op_nocheck(fwnode, op, .... \ > do { > if (fwnode_had_op_nocheck(fwnode, op)) \ > (fwnode)->ops->op(fwnode, ## __VA_ARGS__); > } while (false); > > 3. Add new > static inline fwnode_handle_put(struct fwnode_handle *fwnode) > { > if (!IS_ERR_OR_NULL(fwnode)) > __fwnode_handle_put(fwnode); > } > > Or something like that. > > I'm fine with doing that if conclusion is the complexity of the change > is worth it. > > Jonathan >