Skip to content

Commit 1cdfc3b

Browse files
committed
kern: eliminate the V notices for x >> shift & mask
1 parent 10a35ce commit 1cdfc3b

File tree

1 file changed

+12
-12
lines changed
  • kernel/modules/dev/hda

1 file changed

+12
-12
lines changed

kernel/modules/dev/hda/hda.v

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ pub fn (verb HDAResponseDescriptor) get_codec() u8 {
195195
}
196196

197197
pub fn (verb HDAResponseDescriptor) is_unsol() bool {
198-
return verb.resp_ex >> 4 & 1 != 0
198+
return (verb.resp_ex >> 4) & 1 != 0
199199
}
200200

201201
struct PCMFormat {
@@ -742,7 +742,7 @@ fn (mut c HDACodec) setup_all_output_paths(sample_rate u32, bits u8, channels u8
742742
pub fn (mut c HDACodec) initialize() {
743743
num_func_groups_resp := c.get_parameter(0, hda.param_node_count)
744744
num_func_groups := u8(num_func_groups_resp & 0xFF)
745-
func_groups_start_nid := u8(num_func_groups_resp >> 16 & 0xFF)
745+
func_groups_start_nid := u8((num_func_groups_resp >> 16) & 0xFF)
746746

747747
for func_group_nid := func_groups_start_nid; func_group_nid < func_groups_start_nid +
748748
num_func_groups; func_group_nid++ {
@@ -758,7 +758,7 @@ pub fn (mut c HDACodec) initialize() {
758758

759759
num_widgets_resp := c.get_parameter(func_group_nid, hda.param_node_count)
760760
num_widgets := u8(num_widgets_resp & 0xFF)
761-
widgets_start_nid := u8(num_widgets_resp >> 16 & 0xFF)
761+
widgets_start_nid := u8((num_widgets_resp >> 16) & 0xFF)
762762

763763
print('hda: found ${num_widgets} widgets\n')
764764

@@ -770,7 +770,7 @@ pub fn (mut c HDACodec) initialize() {
770770
con_list_len := u8(c.get_parameter(widget_nid, hda.param_con_list_len))
771771
default_config := c.get_config_default(widget_nid)
772772

773-
widget_type := u8(audio_caps >> 20 & 0b1111)
773+
widget_type := u8((audio_caps >> 20) & 0b1111)
774774

775775
assert (con_list_len & 1 << 7) == 0, "long form connection lists aren't supported"
776776

@@ -794,7 +794,7 @@ pub fn (mut c HDACodec) initialize() {
794794
4
795795
}
796796
for j := 0; j < count; j++ {
797-
nid := u8(resp >> (j * 8) & 0xFF)
797+
nid := u8((resp >> (j * 8)) & 0xFF)
798798
widget.connections << nid
799799
}
800800
}
@@ -876,7 +876,7 @@ __global (
876876

877877
fn (mut c HDAController) submit_verb(cid u8, nid u8, cmd u16, data u8) u8 {
878878
mut corbwp := c.regs.corbwp
879-
index := u8(corbwp >> hda.corbwp_wp_shift & hda.corbwp_wp_mask) + 1
879+
index := u8((corbwp >> hda.corbwp_wp_shift) & hda.corbwp_wp_mask) + 1
880880

881881
mut verb := HDAVerbDescriptor{}
882882
verb.set_cid(cid)
@@ -895,7 +895,7 @@ fn (mut c HDAController) submit_verb(cid u8, nid u8, cmd u16, data u8) u8 {
895895

896896
fn (mut c HDAController) submit_verb_long(cid u8, nid u8, cmd u8, data u16) u8 {
897897
mut corbwp := c.regs.corbwp
898-
index := u8(corbwp >> hda.corbwp_wp_shift & hda.corbwp_wp_mask) + 1
898+
index := u8((corbwp >> hda.corbwp_wp_shift) & hda.corbwp_wp_mask) + 1
899899

900900
mut verb := HDAVerbDescriptor{}
901901
verb.set_cid(cid)
@@ -914,7 +914,7 @@ fn (mut c HDAController) submit_verb_long(cid u8, nid u8, cmd u8, data u16) u8 {
914914

915915
fn (mut c HDAController) wait_for_verb(index u8) HDAResponseDescriptor {
916916
for {
917-
cur_index := c.regs.corbwp >> hda.corbwp_wp_shift & hda.corbwp_wp_mask
917+
cur_index := (c.regs.corbwp >> hda.corbwp_wp_shift) & hda.corbwp_wp_mask
918918
if cur_index == index {
919919
break
920920
}
@@ -971,8 +971,8 @@ pub fn (mut c HDAController) initialise(pci_device &pci.PCIDevice) int {
971971
// if the controller is already running stop it
972972
if gctl & hda.gctl_crst != 0 {
973973
gcap := c.regs.gcap
974-
in_stream_count := gcap >> hda.gcap_iss_shift & hda.gcap_iss_mask
975-
out_stream_count := gcap >> hda.gcap_oss_shift & hda.gcap_oss_mask
974+
in_stream_count := (gcap >> hda.gcap_iss_shift) & hda.gcap_iss_mask
975+
out_stream_count := (gcap >> hda.gcap_oss_shift) & hda.gcap_oss_mask
976976
for i := u64(0); i < in_stream_count; i++ {
977977
mut volatile stream_regs := &HDAStreamRegisters(c.pci_bar.base + 0x80 + i * 0x20 +
978978
higher_half)
@@ -1022,7 +1022,7 @@ pub fn (mut c HDAController) initialise(pci_device &pci.PCIDevice) int {
10221022
}
10231023

10241024
mut corb_size := c.regs.corbsize
1025-
corb_cap := corb_size >> hda.corbsize_szcap_shift & hda.corbsize_szcap_mask
1025+
corb_cap := (corb_size >> hda.corbsize_szcap_shift) & hda.corbsize_szcap_mask
10261026
mut chosen_corb_size := u8(0)
10271027
if corb_cap & 0b100 != 0 {
10281028
chosen_corb_size = 0b10
@@ -1040,7 +1040,7 @@ pub fn (mut c HDAController) initialise(pci_device &pci.PCIDevice) int {
10401040
}
10411041

10421042
mut rirb_size := c.regs.rirbsize
1043-
rirb_cap := rirb_size >> hda.corbsize_szcap_shift & hda.corbsize_szcap_mask
1043+
rirb_cap := (rirb_size >> hda.corbsize_szcap_shift) & hda.corbsize_szcap_mask
10441044
mut chosen_rirb_size := u8(0)
10451045
if rirb_cap & 0b100 != 0 {
10461046
chosen_rirb_size = 0b10

0 commit comments

Comments
 (0)