From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbcBHOR6 (ORCPT ); Mon, 8 Feb 2016 09:17:58 -0500 Received: from down.free-electrons.com ([37.187.137.238]:38064 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750929AbcBHOR4 (ORCPT ); Mon, 8 Feb 2016 09:17:56 -0500 Date: Mon, 8 Feb 2016 15:17:54 +0100 From: Antoine Tenart To: Thomas Gleixner Cc: Antoine Tenart , jason@lakedaemon.net, marc.zyngier@arm.com, tsahee@annapurnalabs.com, rshitrit@annapurnalabs.com, thomas.petazzoni@free-electrons.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] irqchip: add the Alpine MSIX interrupt controller Message-ID: <20160208141754.GG4117@kwain> References: <1454922971-17405-1-git-send-email-antoine.tenart@free-electrons.com> <1454922971-17405-2-git-send-email-antoine.tenart@free-electrons.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="DWg365Y4B18r8evw" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --DWg365Y4B18r8evw Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thomas, On Mon, Feb 08, 2016 at 11:31:47AM +0100, Thomas Gleixner wrote: > On Mon, 8 Feb 2016, Antoine Tenart wrote: > > +static int alpine_msix_set_affinity(struct irq_data *irq_data, > > + const struct cpumask *mask, bool force) > > +{ > > + int ret; > > + > > + ret =3D irq_chip_set_affinity_parent(irq_data, mask, force); > > + return ret =3D=3D IRQ_SET_MASK_OK ? IRQ_SET_MASK_OK_DONE : ret; >=20 > What's the point of this exercise? Why can't you just set the affinity > callback to irq_chip_set_affinity_parent() ? That's what done in irq-gic-v2m.c. Besides that, I see no point. I'll update for v2. > > +static struct irq_chip alpine_msix_irq_chip =3D { > > + .name =3D "MSIx", > > + .irq_mask =3D alpine_msix_mask_msi_irq, > > + .irq_unmask =3D alpine_msix_unmask_msi_irq, > > + .irq_eoi =3D irq_chip_eoi_parent, > > + .irq_set_affinity =3D alpine_msix_set_affinity, > > +}; > > + > > +static int alpine_msix_allocate_sgi(struct alpine_msix_data *priv, int= num_req) > > +{ > > + int first, i; > > + > > + spin_lock(&priv->msi_map_lock); > > + > > + first =3D bitmap_find_next_zero_area(priv->msi_map, priv->num_spis, 0, > > + num_req, 0); > > + if (first >=3D priv->num_spis) { > > + spin_unlock(&priv->msi_map_lock); > > + return -ENOSPC; > > + } > > + > > + for (i =3D 0; i < num_req; i++) > > + set_bit(first + i, priv->msi_map); >=20 > bitmap_set() ?? Indeed, that's better :) > > + spin_unlock(&priv->msi_map_lock); > > + > > + return priv->spi_first + first; > > +} > > + > > +static void alpine_msix_free_sgi(struct alpine_msix_data *priv, unsign= ed sgi, > > + int num_req) > > +{ > > + int i, first; > > + > > + first =3D sgi - priv->spi_first; > > + > > + spin_lock(&priv->msi_map_lock); > > + > > + for (i =3D 0; i < num_req; i++) > > + clear_bit(first + i, priv->msi_map); >=20 > bitmap_clear() ?? Ditto. Antoine --=20 Antoine T=E9nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --DWg365Y4B18r8evw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJWuKORAAoJEFxNi8it27zYBZYP/3LSg2HSUvMO2ClAb+gBKIYX ELSnDk4zWC49XsQI79TKr6xfruZDgbQifdQOTSrWRzq5wApxyTKpWa5HtDNohinZ I1y4t4rtjRv1IoVOq38xSxUgfms0+rZcKibasW9O8lyhowIRnOakGw83W0x481j+ ou47kZ7+w9+MBxX1hTKot7EorykJiqs3G84twTf+rhbyCvpIn6iWnfIt+VT8rLXp hQcM2xUfTUcZbWiXm3PfSEaspGm36hSs2x/HkmmXyGUnmJeJffb8BUZl1z+Z9HW0 oHkCUSbKAPytdKIkn17CXz20eH8S5dpXTI+AprrlsTwbu6KOP4dDw5pJGpJ0i6fQ 7b4mJrX8qOVds2nuHeFpC4xCYJ93xfIsLJfEyxoPdnirAHggqPXwN60CMKbrDlfc FrsDXEoVtJKM85sucB1dgSQc6F7zhnEwUWzXRX3/sOBJ0ILEoWkC6Lb/+dyGtfA3 GH07tTKe5PJij0DVzhq9OgStzVnXr3dTu8wO4ZH44dnor6JyGPuyUWufffWqJktp ksZ2SjFbmbfrifq2HibF4ZGA3itKkg/PBkRTkrFCA2HUXGBjbb0hweo6gKRAAnwr eNs3z4dxMDD1UhzRc48Rfrb7hID86GEkSss7A+RuaSGTziZlPqu2ttagP4arh76r jQbpZxx+aSpttiidoxYe =Cd95 -----END PGP SIGNATURE----- --DWg365Y4B18r8evw--