From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbbJSNZ0 (ORCPT ); Mon, 19 Oct 2015 09:25:26 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:53497 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750904AbbJSNZY (ORCPT ); Mon, 19 Oct 2015 09:25:24 -0400 From: Arnd Bergmann To: Eric Auger Cc: linux-arm-kernel@lists.infradead.org, eric.auger@st.com, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, christoffer.dall@linaro.org, patches@linaro.org Subject: Re: [PATCH 2/4] vfio: platform: reset: calxedaxgmac: add reset function registration Date: Mon, 19 Oct 2015 15:25:08 +0200 Message-ID: <4837895.vpC7yteyEu@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <5624ED6A.5030408@linaro.org> References: <1445184015-24414-1-git-send-email-eric.auger@linaro.org> <3829716.dW4OHEgDOa@wuerfel> <5624ED6A.5030408@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:RAJLdK+wDXfZPGQTHxCd5JZyVA22CETqyhgJfYq32yGWfsVZbcp TRQoacYKUzEn/Z7GmMpWaeBNKr9TpHw+5h+BP/Wri7EMSChTFG2S+3wAMeugp+nAuzR+R/n Jq6gheWSUtCHjteeeJ4D4hkYnIhpZrqqimVGuDudN1xggxDNWio2A/rtQU+DwN9JNAmXG67 +7Z5OlfLBo5dzRQ3948qw== X-UI-Out-Filterresults: notjunk:1;V01:K0:MCNys/5Boq0=:ouizd1o1KD8IwXJW2THgrQ LPVBFLRf8Dfwre3RvOo71/gAK2YDXccxUV5QqOtGwBu/eKPlYA2/aiXzEu9bz1eAJCTg5wjlM 5HH2YosIrQInPudIwSgXP/473aVsh8u2b3oAN519J11cfORq3+j0TaH0kClqzu8grAUo/Cjbz 5NPuN3TUvtpoko8wu855Wi431B6JIN6/ASAJpXyl9nLC59DbfmEi2WqVU5p/xO3p5C0pDBGm7 Y9TaXF7ZRKGmlnYJEtedt1M1TMAUwxLnqkWbzIRFdKAGuz79tcUeQK02HMkt0Oa0O+fzJ1gQ/ I155dZQYNe4Oq91QQ3IvYQ8qd6eRO62v/o72NzCNPc3L/9TBD6JghSpr6ZbnoVCBjD8aYz0Up CZ21zkdywUuxLX2CZ0h1PaceaRxYuktCIQR+D5/k2ENQJESmhZID+5Ll3k6ROXID+/JNRWN/W h/pjCQPTITV3QHyjOPuGedYhZjeKD5s4NvtXfJKlvwA+ewQZjZm1UT4bf71LJgkLW7EPrrAuc r/AttA3SyNdAFwU8yDOdV+AkMvk3qYqLwpS0hWSpXfAniEaKqHSpFN/nLZeyddY87lArO6NBA zwv+9NYD3XRNJhBFECb2rVchppmHJNt1DKrmrcUQl+t8/ZmWo6fQbasp8l/sR2U4vKI1kj8ov 4vAWsS3U87EP/Fiygftyy/8D4JS+AsWRvbRnyhAZ7zzcvmLa3OxTrRPpunBvU3pxFurfb8NJF tUKZS2kjmklT7zFR39ib16XoHV5x3mHYYxuMQg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 19 October 2015 15:17:30 Eric Auger wrote: > Hi Arnd, > On 10/19/2015 03:04 PM, Arnd Bergmann wrote: > > On Sunday 18 October 2015 18:00:13 Eric Auger wrote: > >> diff --git a/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c b/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c > >> index 619dc7d..4f76b17 100644 > >> --- a/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c > >> +++ b/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c > >> @@ -29,8 +29,7 @@ > >> #define DRIVER_VERSION "0.1" > >> #define DRIVER_AUTHOR "Eric Auger " > >> #define DRIVER_DESC "Reset support for Calxeda xgmac vfio platform device" > >> - > >> -#define CALXEDAXGMAC_COMPAT "calxeda,hb-xgmac" > >> +#define COMPAT "calxeda,hb-xgmac" > > > > Why the rename? > This define was not used. Since the code is meant to be duplicated from > one reset module to the other I thought it did not bring any have a > specialized name I'd say it would be clearer to remove the macro then, and pass the string literal in the function call. > >> /* XGMAC Register definitions */ > >> #define XGMAC_CONTROL 0x00000000 /* MAC Configuration */ > >> @@ -80,6 +79,43 @@ int vfio_platform_calxedaxgmac_reset(struct vfio_platform_device *vdev) > >> } > >> EXPORT_SYMBOL_GPL(vfio_platform_calxedaxgmac_reset); > >> > >> +static int __init vfio_platform_calxedaxgmac_init(void) > >> +{ > >> + int (*register_reset)(struct module *, char*, > >> + vfio_platform_reset_fn_t); > >> + int ret; > >> + > >> + register_reset = symbol_get(vfio_platform_register_reset); > >> + if (!register_reset) > >> + return -EINVAL; > > > > I don't understand what you do the symbol_get() here for. > > Why not just call that function directly > the function is implemented in a separate module. This is just to make > sure the vfio-platform module is loaded, in case the end-user attempts > to load the reset module without having this latter loaded. The module loader does all this for you. Arnd