Skip to content
  • Bastien Nocera's avatar
    lib: Add new bus types for drivers · 5c0bc906
    Bastien Nocera authored
    Add a way for drivers to declare they support a bus type other than USB.
    We have declarations for SPI and virtual drivers, though there's no
    device discovery implemented yet.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=106279
    
    Patch modified from the original by Benjamin Berg <bberg@redhat.com>.
    The drivers updates were mainly done using the following spatch:
    
    @drv1@
    identifier driver_name;
    identifier id_table_var;
    @@
    struct fp_driver driver_name = {
    	...,
    -	.id_table = id_table_var,
    +	.bus = BUS_TYPE_USB,
    +	.id_table.usb = id_table_var,
    	...
    };
    @imgdrv1@
    identifier driver_name;
    identifier id_table_var;
    @@
    struct fp_img_driver driver_name = {
    	...,
    	.driver = {
    		...,
    -		.id_table = id_table_var,
    +		.bus = BUS_TYPE_USB,
    +		.id_table.usb = id_table_var,
    		...
    	},
    	...,
    };
    @imgdrv2@
    identifier driver_name;
    identifier discover_func;
    @@
    struct fp_img_driver driver_name = {
    	...,
    	.driver = {
    		...,
    -		.discover = discover_func,
    +		.usb_discover = discover_func,
    		...
    	},
    	...
    };
    @idtable1@
    identifier drv;
    expression x;
    @@
    	struct fp_driver *drv;
    	<...
    -	drv->id_table[x]
    +	drv->id_table.usb[x]
    	...>
    @idtable2@
    identifier drv;
    identifier func;
    expression x;
    @@
    func (..., struct fp_driver *drv, ...)
    {
    	<...
    -	drv->id_table[x]
    +	drv->id_table.usb[x]
    	...>
    }
    5c0bc906