[PATCH 09/16] staging: ks7010: remove KS_WLAN_MEM_FLAG definition

Dan Carpenter dan.carpenter at oracle.com
Fri Apr 6 12:26:53 UTC 2018


On Fri, Apr 06, 2018 at 01:52:47PM +0200, Sergio Paracuellos wrote:
> On Fri, Apr 6, 2018 at 1:07 PM, Dan Carpenter <dan.carpenter at oracle.com> wrote:
> > On Fri, Apr 06, 2018 at 12:38:16PM +0200, Sergio Paracuellos wrote:
> >> This commit removes KS_WLAN_MEM_FLAG definition which is
> >> hiding GFP_ATOMIC along the code. It is better to use directly
> >> GFP_ATOMIC in kmalloc's because this it is easier to read.
> >>
> >> Signed-off-by: Sergio Paracuellos <sergio.paracuellos at gmail.com>
> >> ---
> >>  drivers/staging/ks7010/ks_hostif.c | 6 ++----
> >>  1 file changed, 2 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> >> index e336d25..208c91e 100644
> >> --- a/drivers/staging/ks7010/ks_hostif.c
> >> +++ b/drivers/staging/ks7010/ks_hostif.c
> >> @@ -38,8 +38,6 @@ static inline unsigned int cnt_smeqbody(struct ks_wlan_private *priv)
> >>       return (sme_cnt + SME_EVENT_BUFF_SIZE) % SME_EVENT_BUFF_SIZE;
> >>  }
> >>
> >> -#define KS_WLAN_MEM_FLAG (GFP_ATOMIC)
> >> -
> >>  static inline u8 get_byte(struct ks_wlan_private *priv)
> >>  {
> >>       u8 data;
> >> @@ -1044,7 +1042,7 @@ static void *hostif_generic_request(size_t size, int event)
> >>  {
> >>       struct hostif_hdr *p;
> >>
> >> -     p = kzalloc(hif_align_size(size), KS_WLAN_MEM_FLAG);
> >> +     p = kzalloc(hif_align_size(size), GFP_ATOMIC);
> >
> > If there were a ton of these, then I probably would be OK with a
> > straight sed like this.  But there are only two places.  Probably
> > neither allocation needs to be atomic.  Could you do some research to
> > see if we can just use GFP_KERNEL here?
> 
> I think is correct as it is because it is in a tasklet context so we
> cannot sleep.
> 

I see that the original author thought some of this could be called in
the IRQ handler as well.  Nevermind then.  This patch is fine.

regards,
dan carpenter



More information about the devel mailing list