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

Re: [Xen-devel] [PATCH v16 14/23] x86/VPMU: Initialize VPMUs with __initcall



>>> On 17.12.14 at 16:38, <boris.ostrovsky@xxxxxxxxxx> wrote:
> +int __init amd_vpmu_init(void)
> +{
> +    if ( current_cpu_data.x86_vendor != X86_VENDOR_AMD )
> +        return -EINVAL;

Your only caller guarantees this not to be the case.

> +int __init core2_vpmu_init(void)
> +{
> +    u64 caps;
> +
> +    if ( current_cpu_data.x86_vendor != X86_VENDOR_INTEL )
> +        return -EINVAL;

Same here.

> +static int __init vpmu_init(void)
> +{
> +    int vendor = current_cpu_data.x86_vendor;
> +
> +    if ( vpmu_mode == XENPMU_MODE_OFF )
> +    {
> +        printk(XENLOG_INFO "VPMU: disabled\n");
> +        return 0;
> +    }
> +
> +    switch ( vendor )
> +    {
> +        case X86_VENDOR_AMD:
> +            if ( amd_vpmu_init() )
> +               vpmu_mode = XENPMU_MODE_OFF;
> +            break;
> +        case X86_VENDOR_INTEL:
> +            if ( core2_vpmu_init() )
> +               vpmu_mode = XENPMU_MODE_OFF;
> +            break;
> +        default:
> +            printk(XENLOG_WARNING "VPMU: Unknown CPU vendor: %d\n", vendor);
> +            vpmu_mode = XENPMU_MODE_OFF;

Case labels indented to the same level as the containing switch
please, and break missing here.

> +    }
> +
> +    if ( vpmu_mode == XENPMU_MODE_OFF )
> +        printk(XENLOG_WARNING "VPMU: Disabling due to initialization 
> error\n");
> +    else
> +        printk(XENLOG_INFO "VPMU: version %d.%d\n",
> +               XENPMU_VER_MAJ, XENPMU_VER_MIN);

Use __stringify()?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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