Skip to contentSkip to conversation

firewire: nosy: simplify grabbing context pointer in open()

RFC PATCH New Martin Kepplinger 1 participant 1 message Mar 13, 2015 Firewire

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 firewire: nosy: simplify grabbing context pointer in open()

---

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(-)
drivers/firewire/nosy.c +3 -7
index 76b2d39..f43619e 100644
@@ -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;
Signature · 1 line
2.1.4