From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: corbet@lwn.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Subject: [PATCH v2 3/4] Docs: usb: update comment and code of function skel_delete
Date: Sat, 4 Dec 2021 17:35:24 +0100 [thread overview]
Message-ID: <cff10de3381deedd002e2e8cda884593400b42cb.1638630342.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1638630342.git.philipp.g.hortmann@gmail.com>
Put skel_delete function in the document typical form
Update code according to usb-skeleton.c
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Corrected format of function name to skel_delete()
---
.../driver-api/usb/writing_usb_driver.rst | 21 +++++++++----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/Documentation/driver-api/usb/writing_usb_driver.rst b/Documentation/driver-api/usb/writing_usb_driver.rst
index 297b622f5438..b459f9e089e0 100644
--- a/Documentation/driver-api/usb/writing_usb_driver.rst
+++ b/Documentation/driver-api/usb/writing_usb_driver.rst
@@ -262,19 +262,18 @@ One of the more difficult problems that USB drivers must be able to
handle smoothly is the fact that the USB device may be removed from the
system at any point in time, even if a program is currently talking to
it. It needs to be able to shut down any current reads and writes and
-notify the user-space programs that the device is no longer there. The
-following code (function ``skel_delete``) is an example of how to do
-this::
+notify the user-space programs that the device is no longer there.
+skel_delete() is an example of how to do this::
- static inline void skel_delete (struct usb_skel *dev)
+ static void skel_delete(struct kref *kref)
{
- kfree (dev->bulk_in_buffer);
- if (dev->bulk_out_buffer != NULL)
- usb_free_coherent (dev->udev, dev->bulk_out_size,
- dev->bulk_out_buffer,
- dev->write_urb->transfer_dma);
- usb_free_urb (dev->write_urb);
- kfree (dev);
+ struct usb_skel *dev = to_skel_dev(kref);
+
+ usb_free_urb(dev->bulk_in_urb);
+ usb_put_intf(dev->interface);
+ usb_put_dev(dev->udev);
+ kfree(dev->bulk_in_buffer);
+ kfree(dev);
}
--
2.25.1
next prev parent reply other threads:[~2021-12-04 16:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 16:35 [PATCH v2 0/4] Docs: usb: Code and text updates from usb-skeleton Philipp Hortmann
2021-12-04 16:35 ` [PATCH v2 1/4] Docs: usb: update usb_bulk_msg receiving example Philipp Hortmann
2021-12-05 11:00 ` Greg KH
2021-12-05 17:04 ` Philipp Hortmann
2021-12-06 7:47 ` Greg KH
2021-12-04 16:35 ` [PATCH v2 2/4] Docs: usb: update comment and code near decrement our usage count for the device Philipp Hortmann
2021-12-04 16:35 ` Philipp Hortmann [this message]
2021-12-04 16:35 ` [PATCH v2 4/4] Docs: usb: update explanation for device_present to disconnected Philipp Hortmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cff10de3381deedd002e2e8cda884593400b42cb.1638630342.git.philipp.g.hortmann@gmail.com \
--to=philipp.g.hortmann@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®