Lines Matching refs:fm
164 struct tifm_adapter *fm = container_of(dev, struct tifm_adapter, dev); in tifm_free() local
166 kfree(fm); in tifm_free()
177 struct tifm_adapter *fm; in tifm_alloc_adapter() local
179 fm = kzalloc(struct_size(fm, sockets, num_sockets), GFP_KERNEL); in tifm_alloc_adapter()
180 if (fm) { in tifm_alloc_adapter()
181 fm->dev.class = &tifm_adapter_class; in tifm_alloc_adapter()
182 fm->dev.parent = dev; in tifm_alloc_adapter()
183 device_initialize(&fm->dev); in tifm_alloc_adapter()
184 spin_lock_init(&fm->lock); in tifm_alloc_adapter()
185 fm->num_sockets = num_sockets; in tifm_alloc_adapter()
187 return fm; in tifm_alloc_adapter()
191 int tifm_add_adapter(struct tifm_adapter *fm) in tifm_add_adapter() argument
197 rc = idr_alloc(&tifm_adapter_idr, fm, 0, 0, GFP_NOWAIT); in tifm_add_adapter()
199 fm->id = rc; in tifm_add_adapter()
205 dev_set_name(&fm->dev, "tifm%u", fm->id); in tifm_add_adapter()
206 rc = device_add(&fm->dev); in tifm_add_adapter()
209 idr_remove(&tifm_adapter_idr, fm->id); in tifm_add_adapter()
217 void tifm_remove_adapter(struct tifm_adapter *fm) in tifm_remove_adapter() argument
222 for (cnt = 0; cnt < fm->num_sockets; ++cnt) { in tifm_remove_adapter()
223 if (fm->sockets[cnt]) in tifm_remove_adapter()
224 device_unregister(&fm->sockets[cnt]->dev); in tifm_remove_adapter()
228 idr_remove(&tifm_adapter_idr, fm->id); in tifm_remove_adapter()
230 device_del(&fm->dev); in tifm_remove_adapter()
234 void tifm_free_adapter(struct tifm_adapter *fm) in tifm_free_adapter() argument
236 put_device(&fm->dev); in tifm_free_adapter()
247 struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id, in tifm_alloc_device() argument
263 sock->dev.parent = fm->dev.parent; in tifm_alloc_device()
265 sock->dev.dma_mask = fm->dev.parent->dma_mask; in tifm_alloc_device()
269 tifm_media_type_name(type, 2), fm->id, id); in tifm_alloc_device()
272 tifm_media_type_name(type, 0), fm->id, id); in tifm_alloc_device()
280 struct tifm_adapter *fm = dev_get_drvdata(sock->dev.parent); in tifm_eject() local
281 fm->eject(fm, sock); in tifm_eject()
287 struct tifm_adapter *fm = dev_get_drvdata(sock->dev.parent); in tifm_has_ms_pif() local
288 return fm->has_ms_pif(fm, sock); in tifm_has_ms_pif()