[pinchartl-media:media/drm/du/v3u 16/28] drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:95:2: warning: this decimal constant is unsigned only in ISO C90
by kernel test robot
tree: git://linuxtv.org/pinchartl/media.git media/drm/du/v3u
head: 897fa921c2e92514cb1a6d9395d5d70d254cd3d0
commit: c6b5acb07fd4b8e0ca566e64b688c17126b80e90 [16/28] drm: rcar-du: Add R-Car DSI driver
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add pinchartl-media git://linuxtv.org/pinchartl/media.git
git fetch --no-tags pinchartl-media media/drm/du/v3u
git checkout c6b5acb07fd4b8e0ca566e64b688c17126b80e90
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:95:2: warning: this decimal constant is unsigned only in ISO C90
95 | {2100000000, 0x41}, {2150000000, 0x42}, {2200000000, 0x43},
| ^
>> drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:95:2: warning: this decimal constant is unsigned only in ISO C90
drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:96:2: warning: this decimal constant is unsigned only in ISO C90
96 | {2250000000, 0x44}, {2300000000, 0x45}, {2350000000, 0x46},
| ^
drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:96:2: warning: this decimal constant is unsigned only in ISO C90
drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:96:2: warning: this decimal constant is unsigned only in ISO C90
drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:97:2: warning: this decimal constant is unsigned only in ISO C90
97 | {2400000000, 0x47}, {2450000000, 0x48}, {2500000000, 0x49},
| ^
drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:97:2: warning: this decimal constant is unsigned only in ISO C90
drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:97:2: warning: this decimal constant is unsigned only in ISO C90
>> drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:613:5: warning: no previous prototype for 'rcar_mipi_dsi_clk_enable' [-Wmissing-prototypes]
613 | int rcar_mipi_dsi_clk_enable(struct drm_bridge *bridge)
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c:636:6: warning: no previous prototype for 'rcar_mipi_dsi_clk_disable' [-Wmissing-prototypes]
636 | void rcar_mipi_dsi_clk_disable(struct drm_bridge *bridge)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +95 drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c
75
76 static const u32 hsfreqrange_table[][2] = {
77 {80000000, 0x00}, {90000000, 0x10}, {100000000, 0x20},
78 {110000000, 0x30}, {120000000, 0x01}, {130000000, 0x11},
79 {140000000, 0x21}, {150000000, 0x31}, {160000000, 0x02},
80 {170000000, 0x12}, {180000000, 0x22}, {190000000, 0x32},
81 {205000000, 0x03}, {220000000, 0x13}, {235000000, 0x23},
82 {250000000, 0x33}, {275000000, 0x04}, {300000000, 0x14},
83 {325000000, 0x25}, {350000000, 0x35}, {400000000, 0x05},
84 {450000000, 0x16}, {500000000, 0x26}, {550000000, 0x37},
85 {600000000, 0x07}, {650000000, 0x18}, {700000000, 0x28},
86 {750000000, 0x39}, {800000000, 0x09}, {850000000, 0x19},
87 {900000000, 0x29}, {950000000, 0x3a}, {1000000000, 0x0a},
88 {1050000000, 0x1a}, {1100000000, 0x2a}, {1150000000, 0x3b},
89 {1200000000, 0x0b}, {1250000000, 0x1b}, {1300000000, 0x2b},
90 {1350000000, 0x3c}, {1400000000, 0x0c}, {1450000000, 0x1c},
91 {1500000000, 0x2c}, {1550000000, 0x3d}, {1600000000, 0x0d},
92 {1650000000, 0x1d}, {1700000000, 0x2e}, {1750000000, 0x3e},
93 {1800000000, 0x0e}, {1850000000, 0x1e}, {1900000000, 0x2f},
94 {1950000000, 0x3f}, {2000000000, 0x0f}, {2050000000, 0x40},
> 95 {2100000000, 0x41}, {2150000000, 0x42}, {2200000000, 0x43},
96 {2250000000, 0x44}, {2300000000, 0x45}, {2350000000, 0x46},
97 {2400000000, 0x47}, {2450000000, 0x48}, {2500000000, 0x49},
98 { /* sentinel */ },
99 };
100
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 3 months
Re: [PATCH 08/11] media: adv7842: better document EDID block size
by kernel test robot
Hi Mauro,
I love your patch! Yet something to improve:
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20210616]
[cannot apply to v5.13-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/Address-so...
base: git://linuxtv.org/media_tree.git master
config: alpha-randconfig-r025-20210617 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3bdf84a7467fed26b64ffe547f5989d73...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Mauro-Carvalho-Chehab/Address-some-smatch-warnings/20210617-091510
git checkout 3bdf84a7467fed26b64ffe547f5989d73060a30e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
drivers/media/i2c/adv7842.c: In function 'edid_write_vga_segment':
>> drivers/media/i2c/adv7842.c:739:19: warning: comparison between pointer and integer
739 | for (i = 0; && i < blocks * EDID_BLOCK_SIZE; i += I2C_SMBUS_BLOCK_MAX) {
| ^
>> drivers/media/i2c/adv7842.c:739:2: error: label 'i' used but not defined
739 | for (i = 0; && i < blocks * EDID_BLOCK_SIZE; i += I2C_SMBUS_BLOCK_MAX) {
| ^~~
vim +/i +739 drivers/media/i2c/adv7842.c
715
716 static int edid_write_vga_segment(struct v4l2_subdev *sd)
717 {
718 struct i2c_client *client = v4l2_get_subdevdata(sd);
719 struct adv7842_state *state = to_state(sd);
720 const u8 *edid = state->vga_edid.edid;
721 u32 blocks = state->vga_edid.blocks;
722 int err = 0;
723 int i;
724
725 v4l2_dbg(2, debug, sd, "%s: write EDID on VGA port\n", __func__);
726
727 if (!state->vga_edid.present)
728 return 0;
729
730 /* HPA disable on port A and B */
731 io_write_and_or(sd, 0x20, 0xcf, 0x00);
732
733 /* Disable I2C access to internal EDID ram from VGA DDC port */
734 rep_write_and_or(sd, 0x7f, 0x7f, 0x00);
735
736 /* edid segment pointer '1' for VGA port */
737 rep_write_and_or(sd, 0x77, 0xef, 0x10);
738
> 739 for (i = 0; && i < blocks * EDID_BLOCK_SIZE; i += I2C_SMBUS_BLOCK_MAX) {
740 err = i2c_smbus_write_i2c_block_data(state->i2c_edid, i,
741 I2C_SMBUS_BLOCK_MAX,
742 edid + i);
743 if (err)
744 return err;
745 }
746
747 /* Calculates the checksums and enables I2C access
748 * to internal EDID ram from VGA DDC port.
749 */
750 rep_write_and_or(sd, 0x7f, 0x7f, 0x80);
751
752 for (i = 0; i < 1000; i++) {
753 if (rep_read(sd, 0x79) & 0x20)
754 break;
755 mdelay(1);
756 }
757 if (i == 1000) {
758 v4l_err(client, "error enabling edid on VGA port\n");
759 return -EIO;
760 }
761
762 /* enable hotplug after 200 ms */
763 schedule_delayed_work(&state->delayed_work_enable_hotplug, HZ / 5);
764
765 return 0;
766 }
767
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 3 months
Re: [PATCH v2 2/2] dt-bindings: clock: ad9545: Add documentation
by kernel test robot
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on robh/for-next linux/master linus/master v5.13-rc6 next-20210616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/alexandru-tachici-analog-com/clk...
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: i386-randconfig-s032-20210617 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/b46755cf562ff8a1a9841a4560e344099...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review alexandru-tachici-analog-com/clk-ad9545-Add-support/20210616-153412
git checkout b46755cf562ff8a1a9841a4560e344099f3f054e
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/clk/adi/clk-ad9545.c:1114:43: sparse: sparse: cast from restricted __le32
>> drivers/clk/adi/clk-ad9545.c:1114:43: sparse: sparse: restricted __le32 degrades to integer
>> drivers/clk/adi/clk-ad9545.c:1407:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [addressable] [assigned] [usertype] regval @@ got unsigned int freq_lock_fill_rate @@
drivers/clk/adi/clk-ad9545.c:1407:24: sparse: expected restricted __le32 [addressable] [assigned] [usertype] regval
drivers/clk/adi/clk-ad9545.c:1407:24: sparse: got unsigned int freq_lock_fill_rate
>> drivers/clk/adi/clk-ad9545.c:1409:88: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int val @@ got restricted __le32 [addressable] [assigned] [usertype] regval @@
drivers/clk/adi/clk-ad9545.c:1409:88: sparse: expected unsigned int val
drivers/clk/adi/clk-ad9545.c:1409:88: sparse: got restricted __le32 [addressable] [assigned] [usertype] regval
>> drivers/clk/adi/clk-ad9545.c:1414:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [addressable] [assigned] [usertype] regval @@ got unsigned int freq_lock_drain_rate @@
drivers/clk/adi/clk-ad9545.c:1414:24: sparse: expected restricted __le32 [addressable] [assigned] [usertype] regval
drivers/clk/adi/clk-ad9545.c:1414:24: sparse: got unsigned int freq_lock_drain_rate
drivers/clk/adi/clk-ad9545.c:1416:89: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int val @@ got restricted __le32 [addressable] [assigned] [usertype] regval @@
drivers/clk/adi/clk-ad9545.c:1416:89: sparse: expected unsigned int val
drivers/clk/adi/clk-ad9545.c:1416:89: sparse: got restricted __le32 [addressable] [assigned] [usertype] regval
>> drivers/clk/adi/clk-ad9545.c:1421:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [addressable] [assigned] [usertype] regval @@ got unsigned int phase_lock_fill_rate @@
drivers/clk/adi/clk-ad9545.c:1421:24: sparse: expected restricted __le32 [addressable] [assigned] [usertype] regval
drivers/clk/adi/clk-ad9545.c:1421:24: sparse: got unsigned int phase_lock_fill_rate
drivers/clk/adi/clk-ad9545.c:1423:89: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int val @@ got restricted __le32 [addressable] [assigned] [usertype] regval @@
drivers/clk/adi/clk-ad9545.c:1423:89: sparse: expected unsigned int val
drivers/clk/adi/clk-ad9545.c:1423:89: sparse: got restricted __le32 [addressable] [assigned] [usertype] regval
>> drivers/clk/adi/clk-ad9545.c:1428:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [addressable] [assigned] [usertype] regval @@ got unsigned int phase_lock_drain_rate @@
drivers/clk/adi/clk-ad9545.c:1428:24: sparse: expected restricted __le32 [addressable] [assigned] [usertype] regval
drivers/clk/adi/clk-ad9545.c:1428:24: sparse: got unsigned int phase_lock_drain_rate
drivers/clk/adi/clk-ad9545.c:1430:90: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int val @@ got restricted __le32 [addressable] [assigned] [usertype] regval @@
drivers/clk/adi/clk-ad9545.c:1430:90: sparse: expected unsigned int val
drivers/clk/adi/clk-ad9545.c:1430:90: sparse: got restricted __le32 [addressable] [assigned] [usertype] regval
vim +1114 drivers/clk/adi/clk-ad9545.c
f88d17c990b731 Alexandru Tachici 2021-06-14 1089
f88d17c990b731 Alexandru Tachici 2021-06-14 1090 static int ad9545_out_clk_get_phase(struct clk_hw *hw)
f88d17c990b731 Alexandru Tachici 2021-06-14 1091 {
f88d17c990b731 Alexandru Tachici 2021-06-14 1092 struct ad9545_out_clk *clk = to_out_clk(hw);
f88d17c990b731 Alexandru Tachici 2021-06-14 1093 u64 input_edges_nr;
f88d17c990b731 Alexandru Tachici 2021-06-14 1094 u64 phase_code;
f88d17c990b731 Alexandru Tachici 2021-06-14 1095 __le32 regval;
f88d17c990b731 Alexandru Tachici 2021-06-14 1096 u32 phase_conf;
f88d17c990b731 Alexandru Tachici 2021-06-14 1097 u32 qdiv;
f88d17c990b731 Alexandru Tachici 2021-06-14 1098 int ret;
f88d17c990b731 Alexandru Tachici 2021-06-14 1099
f88d17c990b731 Alexandru Tachici 2021-06-14 1100 ret = ad9545_get_q_div(clk->st, clk->address, &qdiv);
f88d17c990b731 Alexandru Tachici 2021-06-14 1101 if (ret < 0)
f88d17c990b731 Alexandru Tachici 2021-06-14 1102 return ret;
f88d17c990b731 Alexandru Tachici 2021-06-14 1103
f88d17c990b731 Alexandru Tachici 2021-06-14 1104 ret = regmap_read(clk->st->regmap, AD9545_QX_PHASE_CONF(clk->address), &phase_conf);
f88d17c990b731 Alexandru Tachici 2021-06-14 1105 if (ret < 0)
f88d17c990b731 Alexandru Tachici 2021-06-14 1106 return ret;
f88d17c990b731 Alexandru Tachici 2021-06-14 1107
f88d17c990b731 Alexandru Tachici 2021-06-14 1108 ret = regmap_bulk_read(clk->st->regmap, AD9545_QX_PHASE(clk->address), ®val, 4);
f88d17c990b731 Alexandru Tachici 2021-06-14 1109 if (ret < 0)
f88d17c990b731 Alexandru Tachici 2021-06-14 1110 return ret;
f88d17c990b731 Alexandru Tachici 2021-06-14 1111
f88d17c990b731 Alexandru Tachici 2021-06-14 1112 /* Qxy phase bitfield is 33 bits long, with last bit in PHASE_CONF reg */
f88d17c990b731 Alexandru Tachici 2021-06-14 1113 phase_code = !!(phase_conf & AD9545_QX_PHASE_32_MSK);
f88d17c990b731 Alexandru Tachici 2021-06-14 @1114 phase_code = (phase_code >> 32) + cpu_to_le32(regval);
f88d17c990b731 Alexandru Tachici 2021-06-14 1115
f88d17c990b731 Alexandru Tachici 2021-06-14 1116 input_edges_nr = 2 * qdiv + !!(phase_conf & AD9545_QX_HALF_DIV_MSK);
f88d17c990b731 Alexandru Tachici 2021-06-14 1117
f88d17c990b731 Alexandru Tachici 2021-06-14 1118 /*
f88d17c990b731 Alexandru Tachici 2021-06-14 1119 * phase = 360 * (Qxy Phase / E) where:
f88d17c990b731 Alexandru Tachici 2021-06-14 1120 * E is the total number of input edges per output period of the Q-divider.
f88d17c990b731 Alexandru Tachici 2021-06-14 1121 */
f88d17c990b731 Alexandru Tachici 2021-06-14 1122 return div64_u64(phase_code * 360, input_edges_nr);
f88d17c990b731 Alexandru Tachici 2021-06-14 1123 }
f88d17c990b731 Alexandru Tachici 2021-06-14 1124
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 3 months
Re: [PATCH net-next v7 1/3] net: flow_dissector: extend bpf flow dissector support with vnet hdr
by kernel test robot
Hi Tanner,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Tanner-Love/virtio_net-add-optio...
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0c33795231bff5df410bd405b569c66851e92d4b
config: m68k-randconfig-r023-20210617 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/b03a1eb684b925a09ae011d0e620d98eb...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tanner-Love/virtio_net-add-optional-flow-dissection-in-virtio_net_hdr_to_skb/20210617-082208
git checkout b03a1eb684b925a09ae011d0e620d98ebf3b0abd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
net/core/filter.c: In function 'bpf_flow_keys_is_valid_access':
>> net/core/filter.c:7900:15: error: implicit declaration of function 'bpf_get_btf_vmlinux' [-Werror=implicit-function-declaration]
7900 | info->btf = bpf_get_btf_vmlinux();
| ^~~~~~~~~~~~~~~~~~~
>> net/core/filter.c:7900:13: warning: assignment to 'struct btf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
7900 | info->btf = bpf_get_btf_vmlinux();
| ^
cc1: some warnings being treated as errors
vim +/bpf_get_btf_vmlinux +7900 net/core/filter.c
7884
7885 int bpf_flow_keys_is_valid_access(int off, int size, enum bpf_access_type t,
7886 struct bpf_insn_access_aux *info)
7887 {
7888 if (off < 0 ||
7889 (u64)off + size > offsetofend(struct bpf_flow_keys, vhdr))
7890 return -EACCES;
7891
7892 switch (off) {
7893 case bpf_ctx_range_ptr(struct bpf_flow_keys, vhdr):
7894 if (t == BPF_WRITE || off % size != 0 || size != sizeof(__u64))
7895 return -EACCES;
7896
7897 if (!bpf_flow_dissector_btf_ids[0])
7898 return -EINVAL;
7899
> 7900 info->btf = bpf_get_btf_vmlinux();
7901 info->reg_type = PTR_TO_BTF_ID_OR_NULL;
7902 info->btf_id = bpf_flow_dissector_btf_ids[0];
7903
7904 break;
7905 }
7906
7907 return 0;
7908 }
7909
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 3 months
Re: [PATCH 1/3] afs: Handle len being extending over page end in write_begin/write_end
by kernel test robot
Hi David,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.13-rc6 next-20210616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/David-Howells/afs-Handle-len-bei...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 70585216fe7730d9fb5453d3e2804e149d0fe201
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/d5cb85d0ca85764a811baaf4baca5f189...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review David-Howells/afs-Handle-len-being-extending-over-page-end-in-write_begin-write_end/20210617-091000
git checkout d5cb85d0ca85764a811baaf4baca5f1890476434
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
fs/afs/write.c: In function 'afs_write_begin':
>> fs/afs/write.c:40:10: warning: variable 'index' set but not used [-Wunused-but-set-variable]
40 | pgoff_t index;
| ^~~~~
vim +/index +40 fs/afs/write.c
31143d5d515ece David Howells 2007-05-09 26
31143d5d515ece David Howells 2007-05-09 27 /*
d5cb85d0ca8576 David Howells 2021-06-14 28 * Prepare to perform part of a write to a page. Note that len may extend
d5cb85d0ca8576 David Howells 2021-06-14 29 * beyond the end of the page.
31143d5d515ece David Howells 2007-05-09 30 */
15b4650e55e06d Nicholas Piggin 2008-10-15 31 int afs_write_begin(struct file *file, struct address_space *mapping,
15b4650e55e06d Nicholas Piggin 2008-10-15 32 loff_t pos, unsigned len, unsigned flags,
21db2cdc667f74 David Howells 2020-10-22 33 struct page **_page, void **fsdata)
31143d5d515ece David Howells 2007-05-09 34 {
496ad9aa8ef448 Al Viro 2013-01-23 35 struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
15b4650e55e06d Nicholas Piggin 2008-10-15 36 struct page *page;
4343d00872e1de David Howells 2017-11-02 37 unsigned long priv;
e87b03f5830ecd David Howells 2020-10-20 38 unsigned f, from;
e87b03f5830ecd David Howells 2020-10-20 39 unsigned t, to;
e87b03f5830ecd David Howells 2020-10-20 @40 pgoff_t index;
31143d5d515ece David Howells 2007-05-09 41 int ret;
31143d5d515ece David Howells 2007-05-09 42
e87b03f5830ecd David Howells 2020-10-20 43 _enter("{%llx:%llu},%llx,%x",
e87b03f5830ecd David Howells 2020-10-20 44 vnode->fid.vid, vnode->fid.vnode, pos, len);
31143d5d515ece David Howells 2007-05-09 45
3003bbd0697b65 David Howells 2020-02-06 46 /* Prefetch area to be written into the cache if we're caching this
3003bbd0697b65 David Howells 2020-02-06 47 * file. We need to do this before we get a lock on the page in case
3003bbd0697b65 David Howells 2020-02-06 48 * there's more than one writer competing for the same cache block.
3003bbd0697b65 David Howells 2020-02-06 49 */
3003bbd0697b65 David Howells 2020-02-06 50 ret = netfs_write_begin(file, mapping, pos, len, flags, &page, fsdata,
3003bbd0697b65 David Howells 2020-02-06 51 &afs_req_ops, NULL);
3003bbd0697b65 David Howells 2020-02-06 52 if (ret < 0)
31143d5d515ece David Howells 2007-05-09 53 return ret;
630f5dda8442ca David Howells 2020-02-06 54
e87b03f5830ecd David Howells 2020-10-20 55 index = page->index;
d5cb85d0ca8576 David Howells 2021-06-14 56 from = offset_in_thp(page, pos);
d5cb85d0ca8576 David Howells 2021-06-14 57 len = min_t(size_t, len, thp_size(page) - from);
e87b03f5830ecd David Howells 2020-10-20 58 to = from + len;
e87b03f5830ecd David Howells 2020-10-20 59
31143d5d515ece David Howells 2007-05-09 60 try_again:
4343d00872e1de David Howells 2017-11-02 61 /* See if this page is already partially written in a way that we can
4343d00872e1de David Howells 2017-11-02 62 * merge the new write with.
4343d00872e1de David Howells 2017-11-02 63 */
4343d00872e1de David Howells 2017-11-02 64 if (PagePrivate(page)) {
4343d00872e1de David Howells 2017-11-02 65 priv = page_private(page);
67d78a6f6e7b38 David Howells 2020-10-28 66 f = afs_page_dirty_from(page, priv);
67d78a6f6e7b38 David Howells 2020-10-28 67 t = afs_page_dirty_to(page, priv);
4343d00872e1de David Howells 2017-11-02 68 ASSERTCMP(f, <=, t);
4343d00872e1de David Howells 2017-11-02 69
5a039c32271b9a David Howells 2017-11-18 70 if (PageWriteback(page)) {
67d78a6f6e7b38 David Howells 2020-10-28 71 trace_afs_page_dirty(vnode, tracepoint_string("alrdy"), page);
5a039c32271b9a David Howells 2017-11-18 72 goto flush_conflicting_write;
5a039c32271b9a David Howells 2017-11-18 73 }
5a8132761609bd David Howells 2018-04-06 74 /* If the file is being filled locally, allow inter-write
5a8132761609bd David Howells 2018-04-06 75 * spaces to be merged into writes. If it's not, only write
5a8132761609bd David Howells 2018-04-06 76 * back what the user gives us.
5a8132761609bd David Howells 2018-04-06 77 */
5a8132761609bd David Howells 2018-04-06 78 if (!test_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags) &&
5a8132761609bd David Howells 2018-04-06 79 (to < f || from > t))
4343d00872e1de David Howells 2017-11-02 80 goto flush_conflicting_write;
31143d5d515ece David Howells 2007-05-09 81 }
31143d5d515ece David Howells 2007-05-09 82
21db2cdc667f74 David Howells 2020-10-22 83 *_page = page;
4343d00872e1de David Howells 2017-11-02 84 _leave(" = 0");
31143d5d515ece David Howells 2007-05-09 85 return 0;
31143d5d515ece David Howells 2007-05-09 86
4343d00872e1de David Howells 2017-11-02 87 /* The previous write and this write aren't adjacent or overlapping, so
4343d00872e1de David Howells 2017-11-02 88 * flush the page out.
4343d00872e1de David Howells 2017-11-02 89 */
4343d00872e1de David Howells 2017-11-02 90 flush_conflicting_write:
31143d5d515ece David Howells 2007-05-09 91 _debug("flush conflict");
4343d00872e1de David Howells 2017-11-02 92 ret = write_one_page(page);
21db2cdc667f74 David Howells 2020-10-22 93 if (ret < 0)
21db2cdc667f74 David Howells 2020-10-22 94 goto error;
31143d5d515ece David Howells 2007-05-09 95
4343d00872e1de David Howells 2017-11-02 96 ret = lock_page_killable(page);
21db2cdc667f74 David Howells 2020-10-22 97 if (ret < 0)
21db2cdc667f74 David Howells 2020-10-22 98 goto error;
21db2cdc667f74 David Howells 2020-10-22 99 goto try_again;
21db2cdc667f74 David Howells 2020-10-22 100
21db2cdc667f74 David Howells 2020-10-22 101 error:
21db2cdc667f74 David Howells 2020-10-22 102 put_page(page);
4343d00872e1de David Howells 2017-11-02 103 _leave(" = %d", ret);
4343d00872e1de David Howells 2017-11-02 104 return ret;
4343d00872e1de David Howells 2017-11-02 105 }
31143d5d515ece David Howells 2007-05-09 106
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 3 months
Re: [PATCH] usb: xhci-mtk: allow multiple Start-Split in a microframe
by kernel test robot
Hi Chunfeng,
I love your patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.13-rc6 next-20210616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Chunfeng-Yun/usb-xhci-mtk-allow-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/1417adf315cfee06ef79bd1e34266e909...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunfeng-Yun/usb-xhci-mtk-allow-multiple-Start-Split-in-a-microframe/20210617-101730
git checkout 1417adf315cfee06ef79bd1e34266e9098863b5c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/usb/host/xhci-mtk-sch.c: In function 'update_sch_tt':
>> drivers/usb/host/xhci-mtk-sch.c:538:6: warning: variable 'bits' set but not used [-Wunused-but-set-variable]
538 | int bits;
| ^~~~
vim +/bits +538 drivers/usb/host/xhci-mtk-sch.c
08e469de87a253 Chunfeng Yun 2018-09-20 532
6009bea08ad79c Chunfeng Yun 2021-03-08 533 static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
08e469de87a253 Chunfeng Yun 2018-09-20 534 {
08e469de87a253 Chunfeng Yun 2018-09-20 535 struct mu3h_sch_tt *tt = sch_ep->sch_tt;
08e469de87a253 Chunfeng Yun 2018-09-20 536 u32 base, num_esit;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 537 int bw_updated;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 @538 int bits;
08e469de87a253 Chunfeng Yun 2018-09-20 539 int i, j;
08e469de87a253 Chunfeng Yun 2018-09-20 540
08e469de87a253 Chunfeng Yun 2018-09-20 541 num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 542 bits = (sch_ep->ep_type == ISOC_OUT_EP) ? sch_ep->cs_count : 1;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 543
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 544 if (used)
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 545 bw_updated = sch_ep->bw_cost_per_microframe;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 546 else
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 547 bw_updated = -sch_ep->bw_cost_per_microframe;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 548
08e469de87a253 Chunfeng Yun 2018-09-20 549 for (i = 0; i < num_esit; i++) {
08e469de87a253 Chunfeng Yun 2018-09-20 550 base = sch_ep->offset + i * sch_ep->esit;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 551
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 552 for (j = 0; j < sch_ep->cs_count; j++)
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 553 tt->fs_bus_bw[base + j] += bw_updated;
08e469de87a253 Chunfeng Yun 2018-09-20 554 }
08e469de87a253 Chunfeng Yun 2018-09-20 555
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 556 if (used)
08e469de87a253 Chunfeng Yun 2018-09-20 557 list_add_tail(&sch_ep->tt_endpoint, &tt->ep_list);
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 558 else
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 559 list_del(&sch_ep->tt_endpoint);
08e469de87a253 Chunfeng Yun 2018-09-20 560 }
08e469de87a253 Chunfeng Yun 2018-09-20 561
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 3 months
Re: [PATCH v4] drivers: gpio: add virtio-gpio guest driver
by kernel test robot
Hi "Enrico,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.13-rc6 next-20210616]
[cannot apply to linux/master gpio/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Enrico-Weigelt-metux-IT-consult/...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6b00bc639f1f2beeff3595e1bab9faaa51d23b01
config: i386-randconfig-s032-20210617 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/8df8c3f8af32ee316ad10d20fc9d75f6e...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Enrico-Weigelt-metux-IT-consult/drivers-gpio-add-virtio-gpio-guest-driver/20210617-023610
git checkout 8df8c3f8af32ee316ad10d20fc9d75f6e5afae9c
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/gpio/gpio-virtio.c:119:13: sparse: sparse: incorrect type in assignment (different base types) @@ expected int [assigned] ret @@ got restricted __le32 [usertype] value @@
drivers/gpio/gpio-virtio.c:119:13: sparse: expected int [assigned] ret
drivers/gpio/gpio-virtio.c:119:13: sparse: got restricted __le32 [usertype] value
>> drivers/gpio/gpio-virtio.c:197:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] type @@ got unsigned short [usertype] @@
drivers/gpio/gpio-virtio.c:197:19: sparse: expected restricted __le16 [usertype] type
drivers/gpio/gpio-virtio.c:197:19: sparse: got unsigned short [usertype]
>> drivers/gpio/gpio-virtio.c:198:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] pin @@ got unsigned short [usertype] @@
drivers/gpio/gpio-virtio.c:198:19: sparse: expected restricted __le16 [usertype] pin
drivers/gpio/gpio-virtio.c:198:19: sparse: got unsigned short [usertype]
>> drivers/gpio/gpio-virtio.c:199:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] value @@ got unsigned int [usertype] @@
drivers/gpio/gpio-virtio.c:199:19: sparse: expected restricted __le32 [usertype] value
drivers/gpio/gpio-virtio.c:199:19: sparse: got unsigned int [usertype]
>> drivers/gpio/gpio-virtio.c:204:44: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected int event @@ got restricted __le16 [usertype] type @@
drivers/gpio/gpio-virtio.c:204:44: sparse: expected int event
drivers/gpio/gpio-virtio.c:204:44: sparse: got restricted __le16 [usertype] type
>> drivers/gpio/gpio-virtio.c:204:54: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int pin @@ got restricted __le16 [usertype] pin @@
drivers/gpio/gpio-virtio.c:204:54: sparse: expected int pin
drivers/gpio/gpio-virtio.c:204:54: sparse: got restricted __le16 [usertype] pin
>> drivers/gpio/gpio-virtio.c:204:63: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected int value @@ got restricted __le32 [usertype] value @@
drivers/gpio/gpio-virtio.c:204:63: sparse: expected int value
drivers/gpio/gpio-virtio.c:204:63: sparse: got restricted __le32 [usertype] value
>> drivers/gpio/gpio-virtio.c:207:38: sparse: sparse: restricted __le16 degrades to integer
drivers/gpio/gpio-virtio.c:201:19: sparse: sparse: restricted __le16 degrades to integer
>> drivers/gpio/gpio-virtio.c:286:9: sparse: sparse: no generic selection for 'unsigned short virtio_cread_v'
>> drivers/gpio/gpio-virtio.c:286:9: sparse: sparse: incompatible types in comparison expression (different base types):
>> drivers/gpio/gpio-virtio.c:286:9: sparse: bad type *
>> drivers/gpio/gpio-virtio.c:286:9: sparse: unsigned short *
>> drivers/gpio/gpio-virtio.c:286:9: sparse: sparse: no generic selection for 'unsigned short [addressable] virtio_cread_v'
>> drivers/gpio/gpio-virtio.c:288:9: sparse: sparse: no generic selection for 'unsigned int virtio_cread_v'
drivers/gpio/gpio-virtio.c:288:9: sparse: sparse: incompatible types in comparison expression (different base types):
drivers/gpio/gpio-virtio.c:288:9: sparse: bad type *
>> drivers/gpio/gpio-virtio.c:288:9: sparse: unsigned int *
>> drivers/gpio/gpio-virtio.c:288:9: sparse: sparse: no generic selection for 'unsigned int [addressable] virtio_cread_v'
vim +119 drivers/gpio/gpio-virtio.c
100
101 static int virtio_gpio_rpc(struct virtio_gpio_priv *priv, int type,
102 int pin, int value)
103 {
104 int ret;
105 struct virtio_gpio_msg *buf = kzalloc(MSG_BUF_SZ, GFP_KERNEL);
106
107 if (!buf)
108 return -ENOMEM;
109
110 mutex_lock(&priv->rpc_mutex);
111 virtio_gpio_prepare_inbuf(priv);
112 clear_event(priv, type);
113
114 ret = virtio_gpio_xmit(priv, type, pin, value, buf);
115 if (ret)
116 goto out;
117
118 wait_event_interruptible(priv->waitq, check_event(priv, type));
> 119 ret = priv->last.value;
120
121 out:
122 mutex_unlock(&priv->rpc_mutex);
123 kfree(buf);
124 return ret;
125 }
126
127 static int virtio_gpio_direction_input(struct gpio_chip *gc,
128 unsigned int pin)
129 {
130 return virtio_gpio_rpc(gpiochip_get_data(gc),
131 VIRTIO_GPIO_MSG_CPU_DIRECTION_INPUT,
132 pin, 0);
133 }
134
135 static int virtio_gpio_direction_output(struct gpio_chip *gc,
136 unsigned int pin, int value)
137 {
138 return virtio_gpio_rpc(gpiochip_get_data(gc),
139 VIRTIO_GPIO_MSG_CPU_DIRECTION_OUTPUT,
140 pin, value);
141 }
142
143 static int virtio_gpio_get_direction(struct gpio_chip *gc, unsigned int pin)
144 {
145 return virtio_gpio_rpc(gpiochip_get_data(gc),
146 VIRTIO_GPIO_MSG_CPU_GET_DIRECTION,
147 pin, 0);
148 }
149
150 static void virtio_gpio_set(struct gpio_chip *gc,
151 unsigned int pin, int value)
152 {
153 virtio_gpio_rpc(gpiochip_get_data(gc),
154 VIRTIO_GPIO_MSG_CPU_SET_LEVEL, pin, value);
155 }
156
157 static int virtio_gpio_get(struct gpio_chip *gc,
158 unsigned int pin)
159 {
160 return virtio_gpio_rpc(gpiochip_get_data(gc),
161 VIRTIO_GPIO_MSG_CPU_GET_LEVEL, pin, 0);
162 }
163
164 static int virtio_gpio_request(struct gpio_chip *gc,
165 unsigned int pin)
166 {
167 return virtio_gpio_rpc(gpiochip_get_data(gc),
168 VIRTIO_GPIO_MSG_CPU_REQUEST, pin, 0);
169 }
170
171 static void virtio_gpio_signal(struct virtio_gpio_priv *priv, int event,
172 int pin, int value)
173 {
174 int mapped_irq = irq_find_mapping(priv->gc.irq.domain, pin);
175
176 if ((pin < priv->num_gpios) && test_bit(pin, priv->irq_mask))
177 generic_handle_irq(mapped_irq);
178 }
179
180 static void virtio_gpio_data_rx(struct virtqueue *vq)
181 {
182 struct virtio_gpio_priv *priv = vq->vdev->priv;
183 void *data;
184 unsigned int len;
185 struct virtio_gpio_msg *ev;
186
187 data = virtqueue_get_buf(priv->vq_rx, &len);
188 if (!data || !len) {
189 dev_warn(&vq->vdev->dev, "RX received no data ! %d\n", len);
190 return;
191 }
192
193 ev = data;
194
195 memcpy(&priv->last, data, MSG_BUF_SZ);
196
> 197 ev->type = le16_to_cpu(ev->type);
> 198 ev->pin = le16_to_cpu(ev->pin);
> 199 ev->value = le32_to_cpu(ev->value);
200
> 201 switch (ev->type) {
202 case VIRTIO_GPIO_MSG_DEVICE_LEVEL:
203 virtio_gpio_prepare_inbuf(priv);
> 204 virtio_gpio_signal(priv, ev->type, ev->pin, ev->value);
205 break;
206 default:
> 207 wakeup_event(priv, ev->type & ~VIRTIO_GPIO_MSG_REPLY);
208 break;
209 }
210
211 wake_up_all(&priv->waitq);
212
213 devm_kfree(&priv->vdev->dev, data);
214 }
215
216 static int virtio_gpio_alloc_vq(struct virtio_gpio_priv *priv)
217 {
218 struct virtqueue *vqs[2];
219 vq_callback_t *cbs[] = {
220 NULL,
221 virtio_gpio_data_rx,
222 };
223 static const char * const names[] = { "in", "out", };
224 int ret;
225
226 ret = virtio_find_vqs(priv->vdev, 2, vqs, cbs, names, NULL);
227 if (ret) {
228 dev_err(&priv->vdev->dev, "failed to alloc vqs: %d\n", ret);
229 return ret;
230 }
231
232 priv->vq_rx = vqs[0];
233 priv->vq_tx = vqs[1];
234
235 ret = virtio_gpio_prepare_inbuf(priv);
236 if (ret) {
237 dev_err(&priv->vdev->dev, "preparing inbuf failed\n");
238 return ret;
239 }
240
241 virtqueue_enable_cb(priv->vq_rx);
242 virtio_device_ready(priv->vdev);
243
244 return 0;
245 }
246
247 static void virtio_gpio_irq_unmask(struct irq_data *irq)
248 {
249 int hwirq = irqd_to_hwirq(irq);
250 struct virtio_gpio_priv *priv
251 = gpiochip_get_data(irq_data_get_irq_chip_data(irq));
252 if (hwirq < CONFIG_VIRTIO_GPIO_MAX_IRQ)
253 set_bit(hwirq, priv->irq_mask);
254 }
255
256 static void virtio_gpio_irq_mask(struct irq_data *irq)
257 {
258 int hwirq = irqd_to_hwirq(irq);
259 struct virtio_gpio_priv *priv
260 = gpiochip_get_data(irq_data_get_irq_chip_data(irq));
261 if (hwirq < CONFIG_VIRTIO_GPIO_MAX_IRQ)
262 clear_bit(hwirq, priv->irq_mask);
263 }
264
265 static int virtio_gpio_probe(struct virtio_device *vdev)
266 {
267 struct virtio_gpio_priv *priv;
268 struct virtio_gpio_config cf = {};
269 char *name_buffer;
270 const char **gpio_names = NULL;
271 struct device *dev = &vdev->dev;
272 struct gpio_irq_chip *girq;
273
274 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
275 if (!priv)
276 return -ENOMEM;
277
278 priv->name = devm_kzalloc(dev, sizeof(cf.name)+1, GFP_KERNEL);
279 if (!priv->name)
280 return -ENOMEM;
281
282 spin_lock_init(&priv->vq_lock);
283 mutex_init(&priv->rpc_mutex);
284
285 virtio_cread_le(vdev, struct virtio_gpio_config, version, &cf.version);
> 286 virtio_cread_le(vdev, struct virtio_gpio_config, num_gpios,
287 &cf.num_gpios);
> 288 virtio_cread_le(vdev, struct virtio_gpio_config, names_size,
289 &cf.names_size);
290 virtio_cread_bytes(vdev, offsetof(struct virtio_gpio_config, name),
291 priv->name, sizeof(cf.name));
292
293 if (cf.version != 1) {
294 dev_err(dev, "unsupported interface version %d\n", cf.version);
295 return -EINVAL;
296 }
297
298 priv->num_gpios = cf.num_gpios;
299
300 if (cf.names_size) {
301 char *bufwalk;
302 int idx = 0;
303
304 name_buffer = devm_kzalloc(&vdev->dev, cf.names_size,
305 GFP_KERNEL)+1;
306 virtio_cread_bytes(vdev, sizeof(struct virtio_gpio_config),
307 name_buffer, cf.names_size);
308 name_buffer[cf.names_size] = 0;
309
310 gpio_names = devm_kcalloc(dev, priv->num_gpios, sizeof(char *),
311 GFP_KERNEL);
312 bufwalk = name_buffer;
313
314 while (idx < priv->num_gpios &&
315 bufwalk < (name_buffer+cf.names_size)) {
316 gpio_names[idx] = (strlen(bufwalk) ? bufwalk : NULL);
317 bufwalk += strlen(bufwalk)+1;
318 idx++;
319 }
320 }
321
322 priv->vdev = vdev;
323 vdev->priv = priv;
324
325 priv->gc.owner = THIS_MODULE;
326 priv->gc.parent = dev;
327 priv->gc.label = (priv->name[0] ? priv->name
328 : dev_name(dev));
329 priv->gc.ngpio = priv->num_gpios;
330 priv->gc.names = gpio_names;
331 priv->gc.base = -1;
332 priv->gc.request = virtio_gpio_request;
333 priv->gc.direction_input = virtio_gpio_direction_input;
334 priv->gc.direction_output = virtio_gpio_direction_output;
335 priv->gc.get_direction = virtio_gpio_get_direction;
336 priv->gc.get = virtio_gpio_get;
337 priv->gc.set = virtio_gpio_set;
338 priv->gc.can_sleep = true;
339
340 priv->irq_chip.name = "virtio-gpio-irq";
341 priv->irq_chip.irq_mask = virtio_gpio_irq_mask;
342 priv->irq_chip.irq_unmask = virtio_gpio_irq_unmask;
343
344 girq = &priv->gc.irq;
345
346 priv->gc.irq.chip = &priv->irq_chip;
347 priv->gc.irq.num_parents = 1;
348 priv->gc.irq.default_type = IRQ_TYPE_NONE;
349 priv->gc.irq.handler = handle_simple_irq;
350 priv->gc.irq.parents = &priv->irq_parents;
351 priv->irq_parents = 0;
352
353 init_waitqueue_head(&priv->waitq);
354
355 priv->reply_wait = 0;
356
357 virtio_gpio_alloc_vq(priv);
358
359 return devm_gpiochip_add_data(dev, &priv->gc, priv);
360 }
361
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 3 months