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 3/4] Docs: usb: update comment and code of function skel_delete
Date: Mon, 29 Nov 2021 21:21:52 +0100 [thread overview]
Message-ID: <76757c4fc1f5001c3285a9a071055e8715985604.1638152984.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1638152984.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>
---
.../driver-api/usb/writing_usb_driver.rst | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/Documentation/driver-api/usb/writing_usb_driver.rst b/Documentation/driver-api/usb/writing_usb_driver.rst
index b16e4e76d472..74bb72a2f0ac 100644
--- a/Documentation/driver-api/usb/writing_usb_driver.rst
+++ b/Documentation/driver-api/usb/writing_usb_driver.rst
@@ -263,18 +263,17 @@ 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::
+`skel_delete` function 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-11-29 22:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 20:21 [PATCH 0/4] Docs: usb: Code and text updates from usb-skeleton Philipp Hortmann
2021-11-29 20:21 ` [PATCH 1/4] Docs: usb: update usb_bulk_msg receiving example Philipp Hortmann
2021-11-30 20:10 ` Alan Stern
2021-12-02 4:49 ` Philipp Hortmann
2021-12-02 19:49 ` Alan Stern
2021-12-03 2:01 ` Akira Yokosawa
2021-11-29 20:21 ` [PATCH 2/4] Docs: usb: update comment and code near decrement our usage count for the device Philipp Hortmann
2021-11-29 20:21 ` Philipp Hortmann [this message]
2021-12-03 10:57 ` [PATCH 3/4] Docs: usb: update comment and code of function skel_delete Greg KH
2021-11-29 20:21 ` [PATCH 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=76757c4fc1f5001c3285a9a071055e8715985604.1638152984.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.