All of lore.kernel.org
 help / color / mirror / Atom feed
From: amerei@gmail.com (nil acuna)
To: kernelnewbies@lists.kernelnewbies.org
Subject: scsi host refcounting
Date: Sun, 19 Feb 2012 09:24:12 +0000	[thread overview]
Message-ID: <4F40BFBC.5080809@gmail.com> (raw)

Hi,

I'm hot on the trail of how adding a SCSI LLD in the kernel works, but i 
seem to have lost my bearings.

in the scsi_add_host_with_dma() procedure, it device_add()s shost_gendev 
which has the side effect of incrementing the kobj refcount of its 
parent. in my case, its a pci_dev.dev. a few lines after, it calls 
get_device(shost->shost_gendev.parent); which would _also_ increment the 
parent refcount. shouldn't it just do a single bump instead of two? see 
snip below:

-- snip --
     error = device_add(&shost->shost_gendev);
     if (error)
         goto out;

.......

     scsi_host_set_state(shost, SHOST_RUNNING);
     get_device(shost->shost_gendev.parent);
-- snip --

I'm just ocularly following the codes right now so i might have missed a 
device_put on the parent somewhere. please enlighten me on this.

regards

                 reply	other threads:[~2012-02-19  9:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4F40BFBC.5080809@gmail.com \
    --to=amerei@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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.