From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756198AbcL0C4C (ORCPT ); Mon, 26 Dec 2016 21:56:02 -0500 Received: from mga09.intel.com ([134.134.136.24]:28234 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900AbcL0C4A (ORCPT ); Mon, 26 Dec 2016 21:56:00 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,414,1477983600"; d="asc'?scan'208";a="916362471" Date: Tue, 27 Dec 2016 10:51:53 +0800 From: Zhenyu Wang To: Nicolas Iooss Cc: Zhi Wang , igvt-g-dev@ml01.01.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [igvt-g-dev] [PATCH 1/1] drm/i915/gvt: verify functions types in new_mmio_info() Message-ID: <20161227025153.3bnbzfyed7s3ptjy@zhen-hp.sh.intel.com> Reply-To: Zhenyu Wang References: <20161226135223.4563-1-nicolas.iooss_linux@m4x.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="i435ddc5uv55dkqp" Content-Disposition: inline In-Reply-To: <20161226135223.4563-1-nicolas.iooss_linux@m4x.org> User-Agent: NeoMutt/20161126 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --i435ddc5uv55dkqp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2016.12.26 14:52:23 +0100, Nicolas Iooss wrote: > The current prototype of new_mmio_info() uses void* for parameters read > and write, which are functions with precise calling conventions > (argument types and return type). Write down these conventions in > new_mmio_info() definition. >=20 > This has been reported by the following warnings when clang is used to > build the kernel: >=20 > drivers/gpu/drm/i915/gvt/handlers.c:124:21: error: pointer type > mismatch ('void *' and 'int (*)(struct intel_vgpu *, unsigned int, > void *, unsigned int)') [-Werror,-Wpointer-type-mismatch] > info->read =3D read ? read : intel_vgpu_default_mmio_read; > ^ ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/i915/gvt/handlers.c:125:23: error: pointer type > mismatch ('void *' and 'int (*)(struct intel_vgpu *, unsigned int, > void *, unsigned int)') [-Werror,-Wpointer-type-mismatch] > info->write =3D write ? write : intel_vgpu_default_mmio_write; > ^ ~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > This allows the compiler to detect that sbi_ctl_mmio_write() returns a > "bool" value instead of an expected "int" one. Fix this. > Looks good to me. Will queue this up. Thanks > Signed-off-by: Nicolas Iooss > --- > drivers/gpu/drm/i915/gvt/handlers.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/g= vt/handlers.c > index 522809710312..052e57124c0a 100644 > --- a/drivers/gpu/drm/i915/gvt/handlers.c > +++ b/drivers/gpu/drm/i915/gvt/handlers.c > @@ -93,7 +93,8 @@ static void write_vreg(struct intel_vgpu *vgpu, unsigne= d int offset, > static int new_mmio_info(struct intel_gvt *gvt, > u32 offset, u32 flags, u32 size, > u32 addr_mask, u32 ro_mask, u32 device, > - void *read, void *write) > + int (*read)(struct intel_vgpu *, unsigned int, void *, unsigned int), > + int (*write)(struct intel_vgpu *, unsigned int, void *, unsigned int)) > { > struct intel_gvt_mmio_info *info, *p; > u32 start, end, i; > @@ -974,7 +975,7 @@ static int sbi_data_mmio_read(struct intel_vgpu *vgpu= , unsigned int offset, > return 0; > } > =20 > -static bool sbi_ctl_mmio_write(struct intel_vgpu *vgpu, unsigned int off= set, > +static int sbi_ctl_mmio_write(struct intel_vgpu *vgpu, unsigned int offs= et, > void *p_data, unsigned int bytes) > { > u32 data; > --=20 > 2.11.0 >=20 > _______________________________________________ > igvt-g-dev mailing list > igvt-g-dev@lists.01.org > https://lists.01.org/mailman/listinfo/igvt-g-dev --=20 Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 --i435ddc5uv55dkqp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAlhh10kACgkQsQQaM014GCclywCfSJ+/W/fBDWYGrQ4O8j20u7fk h8QAoIW5uO0b9ZLJELEjL4fF1UeQLsqZ =GpAK -----END PGP SIGNATURE----- --i435ddc5uv55dkqp--