[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 03/11] vpci: add tear down functions



>>> On 17.07.18 at 11:48, <roger.pau@xxxxxxxxxx> wrote:
> --- a/xen/drivers/vpci/vpci.c
> +++ b/xen/drivers/vpci/vpci.c
> @@ -31,14 +31,26 @@ struct vpci_register {
>  };
>  
>  #ifdef __XEN__
> -extern vpci_register_init_t *const __start_vpci_array[];
> -extern vpci_register_init_t *const __end_vpci_array[];
> +extern const struct vpci_handler __start_vpci_array[];
> +extern const struct vpci_handler __end_vpci_array[];
>  #define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
>  
>  static void vpci_remove_device_locked(struct pci_dev *pdev)
>  {
> +    unsigned int i;
> +
>      ASSERT(spin_is_locked(&pdev->vpci_lock));
>  
> +    for ( i = 0; i < NUM_VPCI_INIT; i++ )
> +    {
> +        vpci_teardown_t *teardown =
> +            __start_vpci_array[NUM_VPCI_INIT - i - 1].teardown;

Perhaps slightly easier to read if you made the loop count downwards?

>  #define VPCI_PRIORITY_HIGH      "1"
>  #define VPCI_PRIORITY_MIDDLE    "5"
>  #define VPCI_PRIORITY_LOW       "9"
>  
> -#define REGISTER_VPCI_INIT(x, p)                \
> -  static vpci_register_init_t *const x##_entry  \
> -               __used_section(".data.vpci." p) = x
> +#define REGISTER_VPCI_INIT(i, t, p)                                     \
> +  const static struct vpci_handler i ## t ## _entry                     \

Please flip static and const. Iirc we had a case in the past where some
tool (perhaps not a compiler but an analysis tool) choked about this
uncommon ordering.

With these taken care of
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.