Lines Matching full:pf
10 * @pf: board private structure
17 ice_gnss_do_write(struct ice_pf *pf, unsigned char *buf, unsigned int size) in ice_gnss_do_write() argument
20 struct ice_hw *hw = &pf->hw; in ice_gnss_do_write()
69 dev_err(ice_pf_to_dev(pf), "GNSS failed to write, offset=%u, size=%u, err=%d\n", in ice_gnss_do_write()
83 struct ice_pf *pf = gnss->back; in ice_gnss_write_pending() local
92 bytes = ice_gnss_do_write(pf, write_buf->buf, write_buf->size); in ice_gnss_write_pending()
93 dev_dbg(ice_pf_to_dev(pf), "%u bytes written to GNSS\n", bytes); in ice_gnss_write_pending()
115 struct ice_pf *pf; in ice_gnss_read() local
122 pf = gnss->back; in ice_gnss_read()
123 if (!pf || !gnss->tty || !gnss->tty->port) { in ice_gnss_read()
128 hw = &pf->hw; in ice_gnss_read()
194 dev_dbg(ice_pf_to_dev(pf), "GNSS failed to read err=%d\n", err); in ice_gnss_read()
199 * @pf: Board private structure
202 static struct gnss_serial *ice_gnss_struct_init(struct ice_pf *pf, int index) in ice_gnss_struct_init() argument
204 struct device *dev = ice_pf_to_dev(pf); in ice_gnss_struct_init()
214 gnss->back = pf; in ice_gnss_struct_init()
215 pf->gnss_serial[index] = gnss; in ice_gnss_struct_init()
245 struct ice_pf *pf; in ice_gnss_tty_open() local
247 pf = (struct ice_pf *)tty->driver->driver_state; in ice_gnss_tty_open()
248 if (!pf) in ice_gnss_tty_open()
255 gnss = pf->gnss_serial[tty->index]; in ice_gnss_tty_open()
258 gnss = ice_gnss_struct_init(pf, tty->index); in ice_gnss_tty_open()
284 struct ice_pf *pf; in ice_gnss_tty_close() local
289 pf = (struct ice_pf *)tty->driver->driver_state; in ice_gnss_tty_close()
290 if (!pf) in ice_gnss_tty_close()
297 dev_err(ice_pf_to_dev(pf), "GNSS port not opened\n"); in ice_gnss_tty_close()
329 struct ice_pf *pf; in ice_gnss_tty_write() local
340 pf = (struct ice_pf *)tty->driver->driver_state; in ice_gnss_tty_write()
341 if (!pf) in ice_gnss_tty_write()
345 if (gnss != pf->gnss_serial[0]) in ice_gnss_tty_write()
416 * @pf: Board private structure
418 static struct tty_driver *ice_gnss_create_tty_driver(struct ice_pf *pf) in ice_gnss_create_tty_driver() argument
420 struct device *dev = ice_pf_to_dev(pf); in ice_gnss_create_tty_driver()
441 (u8)pf->pdev->bus->number, (u8)PCI_SLOT(pf->pdev->devfn)); in ice_gnss_create_tty_driver()
457 tty_driver->driver_state = pf; in ice_gnss_create_tty_driver()
461 pf->gnss_tty_port[i] = kzalloc(sizeof(*pf->gnss_tty_port[i]), in ice_gnss_create_tty_driver()
463 pf->gnss_serial[i] = NULL; in ice_gnss_create_tty_driver()
465 tty_port_init(pf->gnss_tty_port[i]); in ice_gnss_create_tty_driver()
466 tty_port_link_device(pf->gnss_tty_port[i], tty_driver, i); in ice_gnss_create_tty_driver()
474 tty_port_destroy(pf->gnss_tty_port[i]); in ice_gnss_create_tty_driver()
475 kfree(pf->gnss_tty_port[i]); in ice_gnss_create_tty_driver()
478 tty_driver_kref_put(pf->ice_gnss_tty_driver); in ice_gnss_create_tty_driver()
491 * @pf: Board private structure
493 void ice_gnss_init(struct ice_pf *pf) in ice_gnss_init() argument
497 tty_driver = ice_gnss_create_tty_driver(pf); in ice_gnss_init()
501 pf->ice_gnss_tty_driver = tty_driver; in ice_gnss_init()
503 set_bit(ICE_FLAG_GNSS, pf->flags); in ice_gnss_init()
504 dev_info(ice_pf_to_dev(pf), "GNSS TTY init successful\n"); in ice_gnss_init()
509 * @pf: Board private structure
511 void ice_gnss_exit(struct ice_pf *pf) in ice_gnss_exit() argument
515 if (!test_bit(ICE_FLAG_GNSS, pf->flags) || !pf->ice_gnss_tty_driver) in ice_gnss_exit()
519 if (pf->gnss_tty_port[i]) { in ice_gnss_exit()
520 tty_port_destroy(pf->gnss_tty_port[i]); in ice_gnss_exit()
521 kfree(pf->gnss_tty_port[i]); in ice_gnss_exit()
524 if (pf->gnss_serial[i]) { in ice_gnss_exit()
525 struct gnss_serial *gnss = pf->gnss_serial[i]; in ice_gnss_exit()
530 pf->gnss_serial[i] = NULL; in ice_gnss_exit()
534 tty_unregister_driver(pf->ice_gnss_tty_driver); in ice_gnss_exit()
535 kfree(pf->ice_gnss_tty_driver->name); in ice_gnss_exit()
536 tty_driver_kref_put(pf->ice_gnss_tty_driver); in ice_gnss_exit()
537 pf->ice_gnss_tty_driver = NULL; in ice_gnss_exit()