Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649660

Aw: Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver

From "Lino Sanfilippo" <LinoSanfilippo@gmx.de>
Newsgroups linux.kernel
Subject Aw: Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver
Date 2017-05-24 16:30 +0200
Message-ID <tKFsu-3ss-17@gated-at.bofh.it> (permalink)
References (1 earlier) <tKhTb-3GR-5@gated-at.bofh.it> <tKmzw-6Qv-21@gated-at.bofh.it> <tKnOW-7FB-17@gated-at.bofh.it> <tKpnJ-w5-53@gated-at.bofh.it> <tKAsO-ma-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

> Gesendet: Mittwoch, 24. Mai 2017 um 11:06 Uhr
> Von: "Stefan Wahren" <stefan.wahren@i2se.com>
> An: "Lino Sanfilippo" <LinoSanfilippo@gmx.de>, "Rob Herring" <robh+dt@kernel.org>, "Mark Rutland" <mark.rutland@arm.com>, "David S. Miller" <davem@davemloft.net>
> Cc: linux-serial@vger.kernel.org, "Jiri Slaby" <jslaby@suse.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Jakub Kicinski" <kubakici@wp.pl>, devicetree@vger.kernel.org
> Betreff: Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver
>
> Am 23.05.2017 um 23:01 schrieb Lino Sanfilippo:
> > On 23.05.2017 21:38, Stefan Wahren wrote:
> >>> Lino Sanfilippo <LinoSanfilippo@gmx.de> hat am 23. Mai 2017 um 20:16 geschrieben:
> >>>
> >>> I suggest to avoid this possible race by first unregistering the netdevice and then 
> >>> calling cancel_work_sync().
> >> What makes you sure that's safe to unregister the netdev while the tx work queue is possibly active?
> > unregister_netdevice() calls netdev_close() if the interface is still up. netdev_close() calls flush_work()
> > so the unregistration is delayed until the tx work function is finished. Furthermore both close() and
> > tx work are synchronized by means of the qca->lock which also guarantees that unregister_netdevice() wont
> > be finished until the tx work is done.
> >
> 
> Thanks for the explanation. I suspect there could be the same race
> between serdev_device_close() and the tx work queue.
> 
> So i would propose a variant of your original suggestion:
> 
> unregister_netdev(qca->net_dev);
> 
> /* Flush any pending characters in the driver. */
> serdev_device_close(serdev);
> cancel_work_sync(&qca->tx_work);
> 
> Since we have the same pattern in the error path of the probe function,
> the same applies there.

Agreed, it is much cleaner to have the same cleanup pattern in remove() as
we have in (error case of) probe().

Regards,
Lino

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
  Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2017-05-23 20:20 +0200
    Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART  driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 21:40 +0200
      Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2017-05-23 23:20 +0200
        Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-24 11:10 +0200
          [PATCH v7 net-next 17/17] net: qualcomm: add QCA7000 UART driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-24 11:40 +0200
            Re: [PATCH v7 net-next 17/17] net: qualcomm: add QCA7000 UART  driver David Miller <davem@davemloft.net> - 2017-05-25 19:20 +0200
          [PATCH RESEND v7 net-next 17/17] net: qualcomm: add QCA7000 UART driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-24 11:40 +0200
            Re: [PATCH RESEND v7 net-next 17/17] net: qualcomm: add QCA7000  UART driver "Lino Sanfilippo" <LinoSanfilippo@gmx.de> - 2017-05-24 16:30 +0200
              Re: [PATCH RESEND v7 net-next 17/17] net: qualcomm: add QCA7000 UART  driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-24 16:40 +0200
          Aw: Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART  driver "Lino Sanfilippo" <LinoSanfilippo@gmx.de> - 2017-05-24 16:30 +0200

csiph-web