• Bhumika Goyal's avatar
    qlogic: qlcnic_sysfs: constify bin_attribute structures · 0ccea221
    Bhumika Goyal authored
    Declare bin_attribute structures as const as they are only passed as an
    arguments to the functions device_remove_bin_file and
    device_create_bin_file. These function arguments are of type const, so
    bin_attribute structures having this property can be made const too.
    Done using Coccinelle:
    
    @r1 disable optional_qualifier @
    identifier i;
    position p;
    @@
    static struct bin_attribute i@p = {...};
    
    @ok1@
    identifier r1.i;
    position p,p1;
    @@
    (
    device_remove_bin_file(...,&i@p)
    |
    device_create_bin_file(..., &i@p1)
    )
    
    @bad@
    position p!={r1.p,ok1.p,ok1.p1};
    identifier r1.i;
    @@
    i@p
    
    @depends on !bad disable optional_qualifier@
    identifier r1.i;
    @@
    +const
    struct bin_attribute i;
    Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    0ccea221
qlcnic_sysfs.c 36.2 KB