mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [RFC] firewire: nosy: simplify grabbing context pointer in open()
@ 2015-03-13 17:33 Martin Kepplinger
  0 siblings, 0 replies; only message in thread
From: Martin Kepplinger @ 2015-03-13 17:33 UTC (permalink / raw)
  To: stefanr; +Cc: linux1394-devel, linux-kernel, Martin Kepplinger

Signed-off-by: Martin Kepplinger <martink@posteo.de>
---

This is a question: What's the real difference between the two solutions?
I'm not sure if they are equivalent :(


 drivers/firewire/nosy.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c
index 76b2d39..f43619e 100644
--- a/drivers/firewire/nosy.c
+++ b/drivers/firewire/nosy.c
@@ -275,16 +275,12 @@ set_phy_reg(struct pcilynx *lynx, int addr, int val)
 static int
 nosy_open(struct inode *inode, struct file *file)
 {
-	int minor = iminor(inode);
 	struct client *client;
-	struct pcilynx *tmp, *lynx = NULL;
+	struct pcilynx *lynx = NULL;
 
 	mutex_lock(&card_mutex);
-	list_for_each_entry(tmp, &card_list, link)
-		if (tmp->misc.minor == minor) {
-			lynx = lynx_get(tmp);
-			break;
-		}
+	lynx = container_of(file->private_data, struct pcilynx, misc);
+	lynx = lynx_get(lynx);
 	mutex_unlock(&card_mutex);
 	if (lynx == NULL)
 		return -ENODEV;
-- 
2.1.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-13 17:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 17:33 [PATCH] [RFC] firewire: nosy: simplify grabbing context pointer in open() Martin Kepplinger

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®