lkml.org 
[lkml]   [2020]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/10] rpmsg: ns: Make Name service module transport agnostic
Hi Mathieu,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20200921]
[cannot apply to linux/master linus/master rpmsg/for-next v5.9-rc6 v5.9-rc5 v5.9-rc4 v5.9-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/Mathieu-Poirier/rpmsg-Make-RPMSG-name-service-modular/20200922-081745
base: b10b8ad862118bf42c28a98b0f067619aadcfb23
config: i386-randconfig-s001-20200921 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-201-g24bdaac6-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

drivers/rpmsg/virtio_rpmsg_bus.c:165:43: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __virtio16 [usertype] val @@ got unsigned short [usertype] val @@
drivers/rpmsg/virtio_rpmsg_bus.c:165:43: sparse: expected restricted __virtio16 [usertype] val
drivers/rpmsg/virtio_rpmsg_bus.c:165:43: sparse: got unsigned short [usertype] val
drivers/rpmsg/virtio_rpmsg_bus.c:173:31: sparse: sparse: incorrect type in return expression (different base types) @@ expected unsigned short @@ got restricted __virtio16 @@
drivers/rpmsg/virtio_rpmsg_bus.c:173:31: sparse: expected unsigned short
drivers/rpmsg/virtio_rpmsg_bus.c:173:31: sparse: got restricted __virtio16
drivers/rpmsg/virtio_rpmsg_bus.c:181:43: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __virtio32 [usertype] val @@ got unsigned int [usertype] val @@
drivers/rpmsg/virtio_rpmsg_bus.c:181:43: sparse: expected restricted __virtio32 [usertype] val
drivers/rpmsg/virtio_rpmsg_bus.c:181:43: sparse: got unsigned int [usertype] val
drivers/rpmsg/virtio_rpmsg_bus.c:189:31: sparse: sparse: incorrect type in return expression (different base types) @@ expected unsigned int @@ got restricted __virtio32 @@
drivers/rpmsg/virtio_rpmsg_bus.c:189:31: sparse: expected unsigned int
drivers/rpmsg/virtio_rpmsg_bus.c:189:31: sparse: got restricted __virtio32
>> drivers/rpmsg/virtio_rpmsg_bus.c:267:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [usertype] addr @@ got restricted __virtio32 @@
>> drivers/rpmsg/virtio_rpmsg_bus.c:267:26: sparse: expected unsigned int [addressable] [usertype] addr
drivers/rpmsg/virtio_rpmsg_bus.c:267:26: sparse: got restricted __virtio32
>> drivers/rpmsg/virtio_rpmsg_bus.c:268:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [usertype] flags @@ got restricted __virtio32 @@
>> drivers/rpmsg/virtio_rpmsg_bus.c:268:27: sparse: expected unsigned int [addressable] [usertype] flags
drivers/rpmsg/virtio_rpmsg_bus.c:268:27: sparse: got restricted __virtio32
drivers/rpmsg/virtio_rpmsg_bus.c:291:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [usertype] addr @@ got restricted __virtio32 @@
drivers/rpmsg/virtio_rpmsg_bus.c:291:26: sparse: expected unsigned int [addressable] [usertype] addr
drivers/rpmsg/virtio_rpmsg_bus.c:291:26: sparse: got restricted __virtio32
drivers/rpmsg/virtio_rpmsg_bus.c:292:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [usertype] flags @@ got restricted __virtio32 @@
drivers/rpmsg/virtio_rpmsg_bus.c:292:27: sparse: expected unsigned int [addressable] [usertype] flags
drivers/rpmsg/virtio_rpmsg_bus.c:292:27: sparse: got restricted __virtio32

# https://github.com/0day-ci/linux/commit/ab159ea48198df2ab06ff9fe97e63cca354bff20
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Mathieu-Poirier/rpmsg-Make-RPMSG-name-service-modular/20200922-081745
git checkout ab159ea48198df2ab06ff9fe97e63cca354bff20
vim +267 drivers/rpmsg/virtio_rpmsg_bus.c

dd032e0b67fcd61 Mathieu Poirier 2020-09-21 167
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 168 static u16 virtio_rpmsg_cpu_to_transport16(struct rpmsg_device *rpdev, u16 val)
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 169 {
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 170 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 171 struct virtproc_info *vrp = vch->vrp;
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 172
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 @173 return cpu_to_virtio16(vrp->vdev, val);
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 174 }
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 175
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 176 static u32 virtio_rpmsg_transport32_to_cpu(struct rpmsg_device *rpdev, u32 val)
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 177 {
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 178 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 179 struct virtproc_info *vrp = vch->vrp;
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 180
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 @181 return virtio32_to_cpu(vrp->vdev, val);
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 182 }
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 183
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 184 static u32 virtio_rpmsg_cpu_to_transport32(struct rpmsg_device *rpdev, u32 val)
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 185 {
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 186 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 187 struct virtproc_info *vrp = vch->vrp;
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 188
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 189 return cpu_to_virtio32(vrp->vdev, val);
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 190 }
dd032e0b67fcd61 Mathieu Poirier 2020-09-21 191
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 192 static struct rpmsg_device *
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 193 virtio_rpmsg_create_channel(struct rpmsg_device *rpdev,
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 194 struct rpmsg_channel_info *chinfo)
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 195 {
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 196 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 197 struct virtproc_info *vrp = vch->vrp;
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 198
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 199 return __rpmsg_create_channel(vrp, chinfo);
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 200 }
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 201
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 202 static int virtio_rpmsg_release_channel(struct rpmsg_device *rpdev,
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 203 struct rpmsg_channel_info *chinfo)
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 204 {
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 205 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 206 struct virtproc_info *vrp = vch->vrp;
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 207
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 208 return rpmsg_unregister_device(&vrp->vdev->dev, chinfo);
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 209 }
644f6e9ac5ebdd8 Arnaud Pouliquen 2020-09-21 210
36b72c7dca71871 Bjorn Andersson 2016-09-01 211 static struct rpmsg_endpoint *virtio_rpmsg_create_ept(struct rpmsg_device *rpdev,
36b72c7dca71871 Bjorn Andersson 2016-09-01 212 rpmsg_rx_cb_t cb,
36b72c7dca71871 Bjorn Andersson 2016-09-01 213 void *priv,
36b72c7dca71871 Bjorn Andersson 2016-09-01 214 struct rpmsg_channel_info chinfo)
36b72c7dca71871 Bjorn Andersson 2016-09-01 215 {
3bf950ff23337fc Bjorn Andersson 2016-09-01 216 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
3bf950ff23337fc Bjorn Andersson 2016-09-01 217
3bf950ff23337fc Bjorn Andersson 2016-09-01 218 return __rpmsg_create_ept(vch->vrp, rpdev, cb, priv, chinfo.src);
36b72c7dca71871 Bjorn Andersson 2016-09-01 219 }
36b72c7dca71871 Bjorn Andersson 2016-09-01 220
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 221 /**
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 222 * __rpmsg_destroy_ept() - destroy an existing rpmsg endpoint
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 223 * @vrp: virtproc which owns this ept
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 224 * @ept: endpoing to destroy
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 225 *
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 226 * An internal function which destroy an ept without assuming it is
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 227 * bound to an rpmsg channel. This is needed for handling the internal
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 228 * name service endpoint, which isn't bound to an rpmsg channel.
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 229 * See also __rpmsg_create_ept().
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 230 */
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 231 static void
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 232 __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept)
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 233 {
15fd943af50dbc5 Ohad Ben-Cohen 2012-06-07 234 /* make sure new inbound messages can't find this ept anymore */
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 235 mutex_lock(&vrp->endpoints_lock);
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 236 idr_remove(&vrp->endpoints, ept->addr);
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 237 mutex_unlock(&vrp->endpoints_lock);
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 238
15fd943af50dbc5 Ohad Ben-Cohen 2012-06-07 239 /* make sure in-flight inbound messages won't invoke cb anymore */
15fd943af50dbc5 Ohad Ben-Cohen 2012-06-07 240 mutex_lock(&ept->cb_lock);
15fd943af50dbc5 Ohad Ben-Cohen 2012-06-07 241 ept->cb = NULL;
15fd943af50dbc5 Ohad Ben-Cohen 2012-06-07 242 mutex_unlock(&ept->cb_lock);
15fd943af50dbc5 Ohad Ben-Cohen 2012-06-07 243
5a081caa0414b9b Ohad Ben-Cohen 2012-06-06 244 kref_put(&ept->refcount, __ept_release);
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 245 }
fa2d7795b2e8595 Ohad Ben-Cohen 2012-02-09 246
8a228ecfe086b84 Bjorn Andersson 2016-09-01 247 static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
8a228ecfe086b84 Bjorn Andersson 2016-09-01 248 {
3bf950ff23337fc Bjorn Andersson 2016-09-01 249 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(ept->rpdev);
3bf950ff23337fc Bjorn Andersson 2016-09-01 250
3bf950ff23337fc Bjorn Andersson 2016-09-01 251 __rpmsg_destroy_ept(vch->vrp, ept);
8a228ecfe086b84 Bjorn Andersson 2016-09-01 252 }
8a228ecfe086b84 Bjorn Andersson 2016-09-01 253
36b72c7dca71871 Bjorn Andersson 2016-09-01 254 static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev)
36b72c7dca71871 Bjorn Andersson 2016-09-01 255 {
3bf950ff23337fc Bjorn Andersson 2016-09-01 256 struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
3bf950ff23337fc Bjorn Andersson 2016-09-01 257 struct virtproc_info *vrp = vch->vrp;
36b72c7dca71871 Bjorn Andersson 2016-09-01 258 struct device *dev = &rpdev->dev;
36b72c7dca71871 Bjorn Andersson 2016-09-01 259 int err = 0;
36b72c7dca71871 Bjorn Andersson 2016-09-01 260
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 261 /* need to tell remote processor's name service about this channel ? */
b2599ebffb2d32e Henri Roosen 2017-06-02 262 if (rpdev->announce && rpdev->ept &&
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 263 virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 264 struct rpmsg_ns_msg nsm;
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 265
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 266 strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE);
111d1089700cdb7 Guennadi Liakhovetski 2020-07-21 @267 nsm.addr = cpu_to_virtio32(vrp->vdev, rpdev->ept->addr);
111d1089700cdb7 Guennadi Liakhovetski 2020-07-21 @268 nsm.flags = cpu_to_virtio32(vrp->vdev, RPMSG_NS_CREATE);
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 269
2a48d7322dc88f1 Bjorn Andersson 2016-09-01 270 err = rpmsg_sendto(rpdev->ept, &nsm, sizeof(nsm), RPMSG_NS_ADDR);
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 271 if (err)
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 272 dev_err(dev, "failed to announce service %d\n", err);
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 273 }
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 274
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 275 return err;
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 276 }
bcabbccabffe732 Ohad Ben-Cohen 2011-10-20 277

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2020-09-23 04:40    [W:0.216 / U:3.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site