1*6ed8e091Sthorpej /* $NetBSD: device_calls.h,v 1.1 2021/09/15 17:33:08 thorpej Exp $ */ 2*6ed8e091Sthorpej 3*6ed8e091Sthorpej /* 4*6ed8e091Sthorpej * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. 5*6ed8e091Sthorpej * 6*6ed8e091Sthorpej * generated from: 7*6ed8e091Sthorpej * NetBSD: device_calls,v 1.1 2021/09/15 17:26:06 thorpej Exp 8*6ed8e091Sthorpej */ 9*6ed8e091Sthorpej 10*6ed8e091Sthorpej /*- 11*6ed8e091Sthorpej * Copyright (c) 2021 The NetBSD Foundation, Inc. 12*6ed8e091Sthorpej * All rights reserved. 13*6ed8e091Sthorpej * 14*6ed8e091Sthorpej * This code is derived from software contributed to The NetBSD Foundation 15*6ed8e091Sthorpej * by Jason R. Thorpe. 16*6ed8e091Sthorpej * 17*6ed8e091Sthorpej * Redistribution and use in source and binary forms, with or without 18*6ed8e091Sthorpej * modification, are permitted provided that the following conditions 19*6ed8e091Sthorpej * are met: 20*6ed8e091Sthorpej * 1. Redistributions of source code must retain the above copyright 21*6ed8e091Sthorpej * notice, this list of conditions and the following disclaimer. 22*6ed8e091Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 23*6ed8e091Sthorpej * notice, this list of conditions and the following disclaimer in the 24*6ed8e091Sthorpej * documentation and/or other materials provided with the distribution. 25*6ed8e091Sthorpej * 26*6ed8e091Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27*6ed8e091Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28*6ed8e091Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29*6ed8e091Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30*6ed8e091Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31*6ed8e091Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32*6ed8e091Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33*6ed8e091Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34*6ed8e091Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35*6ed8e091Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36*6ed8e091Sthorpej * POSSIBILITY OF SUCH DAMAGE. 37*6ed8e091Sthorpej */ 38*6ed8e091Sthorpej 39*6ed8e091Sthorpej /* 40*6ed8e091Sthorpej * Device calls used by the device autoconfiguration subsystem 41*6ed8e091Sthorpej */ 42*6ed8e091Sthorpej 43*6ed8e091Sthorpej #ifndef _DEVICE_CALLS_H_ 44*6ed8e091Sthorpej #define _DEVICE_CALLS_H_ 45*6ed8e091Sthorpej 46*6ed8e091Sthorpej #include <sys/device.h> 47*6ed8e091Sthorpej 48*6ed8e091Sthorpej /* 49*6ed8e091Sthorpej * device-enumerate-children 50*6ed8e091Sthorpej * 51*6ed8e091Sthorpej * Enumerates the direct children of a device, invoking the callback for 52*6ed8e091Sthorpej * each one. The callback is passed the devhandle_t corresponding to the 53*6ed8e091Sthorpej * child device, as well as a user-supplied argument. If the callback 54*6ed8e091Sthorpej * returns true, then enumeration continues. If the callback returns false, 55*6ed8e091Sthorpej * enumeration is stopped. 56*6ed8e091Sthorpej */ 57*6ed8e091Sthorpej struct device_enumerate_children_args { 58*6ed8e091Sthorpej bool (*callback)(device_t, devhandle_t, void *); 59*6ed8e091Sthorpej void * callback_arg; 60*6ed8e091Sthorpej }; 61*6ed8e091Sthorpej 62*6ed8e091Sthorpej union device_enumerate_children_binding { 63*6ed8e091Sthorpej struct device_call_generic generic; 64*6ed8e091Sthorpej struct { 65*6ed8e091Sthorpej const char *name; 66*6ed8e091Sthorpej struct device_enumerate_children_args *args; 67*6ed8e091Sthorpej } binding; 68*6ed8e091Sthorpej }; 69*6ed8e091Sthorpej 70*6ed8e091Sthorpej #define DEVICE_ENUMERATE_CHILDREN_STR "device-enumerate-children" 71*6ed8e091Sthorpej 72*6ed8e091Sthorpej #define DEVICE_ENUMERATE_CHILDREN(_args_) \ 73*6ed8e091Sthorpej &((const union device_enumerate_children_binding){ \ 74*6ed8e091Sthorpej .binding.name = "device-enumerate-children", \ 75*6ed8e091Sthorpej .binding.args = (_args_), \ 76*6ed8e091Sthorpej }) 77*6ed8e091Sthorpej 78*6ed8e091Sthorpej #endif /* _DEVICE_CALLS_H_ */ 79