diff --git a/[refs] b/[refs] index cdba299917ce..3e8f87cf9eea 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 104640606be0df6bcdb5ec7960a9c3c1278117ae +refs/heads/master: bc3954b8147402e4495378d982cc8e708703a0f1 diff --git a/trunk/drivers/staging/comedi/comedidev.h b/trunk/drivers/staging/comedi/comedidev.h index e2b7d606e1c0..503dd8c4b302 100644 --- a/trunk/drivers/staging/comedi/comedidev.h +++ b/trunk/drivers/staging/comedi/comedidev.h @@ -429,20 +429,19 @@ static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd) return sizeof(short); } -/* must be used in attach to set dev->hw_dev if you wish to dma directly -into comedi's buffer */ +/* + * Must set dev->hw_dev if you wish to dma directly into comedi's buffer. + * Also useful for retrieving a previously configured hardware device of + * known bus type. Set automatically for auto-configured devices. + * Automatically set to NULL when detaching hardware device. + */ static inline void comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev) { - if (dev->hw_dev == hw_dev) - return; - if (dev->hw_dev) - put_device(dev->hw_dev); - dev->hw_dev = hw_dev; - if (dev->hw_dev) { - dev->hw_dev = get_device(dev->hw_dev); - BUG_ON(dev->hw_dev == NULL); - } + struct device *old_hw_dev = dev->hw_dev; + + dev->hw_dev = get_device(hw_dev); + put_device(old_hw_dev); } static inline struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev)