drivers/net/ethernet/toshiba/ps3_gelic_wireless.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
Extension
.c
Size
68962 bytes
Lines
2654
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct net_device_ops gelic_wl_netdevice_ops = {
	.ndo_open = gelic_wl_open,
	.ndo_stop = gelic_wl_stop,
	.ndo_start_xmit = gelic_net_xmit,
	.ndo_set_rx_mode = gelic_net_set_multi,
	.ndo_tx_timeout = gelic_net_tx_timeout,
	.ndo_set_mac_address = eth_mac_addr,
	.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
	.ndo_poll_controller = gelic_net_poll_controller,
#endif
};

static const struct ethtool_ops gelic_wl_ethtool_ops = {
	.get_drvinfo	= gelic_net_get_drvinfo,
	.get_link	= gelic_wl_get_link,
};

static void gelic_wl_setup_netdev_ops(struct net_device *netdev)
{
	struct gelic_wl_info *wl;
	wl = port_wl(netdev_priv(netdev));
	BUG_ON(!wl);
	netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT;

	netdev->ethtool_ops = &gelic_wl_ethtool_ops;
	netdev->netdev_ops = &gelic_wl_netdevice_ops;
	netdev->wireless_handlers = &gelic_wl_wext_handler_def;
}

/*
 * driver probe/remove
 */
int gelic_wl_driver_probe(struct gelic_card *card)
{
	int ret;
	struct net_device *netdev;

	pr_debug("%s:start\n", __func__);

	if (ps3_compare_firmware_version(1, 6, 0) < 0)
		return 0;
	if (!card->vlan[GELIC_PORT_WIRELESS].tx)
		return 0;

	/* alloc netdevice for wireless */
	netdev = gelic_wl_alloc(card);
	if (!netdev)
		return -ENOMEM;

	/* setup net_device structure */
	SET_NETDEV_DEV(netdev, &card->dev->core);
	gelic_wl_setup_netdev_ops(netdev);

	/* setup some of net_device and register it */
	ret = gelic_net_setup_netdev(netdev, card);
	if (ret)
		goto fail_setup;
	card->netdev[GELIC_PORT_WIRELESS] = netdev;

	/* add enable wireless interrupt */
	card->irq_mask |= GELIC_CARD_WLAN_EVENT_RECEIVED |
		GELIC_CARD_WLAN_COMMAND_COMPLETED;
	/* to allow wireless commands while both interfaces are down */
	gelic_card_set_irq_mask(card, GELIC_CARD_WLAN_EVENT_RECEIVED |
				GELIC_CARD_WLAN_COMMAND_COMPLETED);
	pr_debug("%s:end\n", __func__);
	return 0;

fail_setup:
	gelic_wl_free(port_wl(netdev_port(netdev)));

	return ret;
}

int gelic_wl_driver_remove(struct gelic_card *card)
{
	struct gelic_wl_info *wl;
	struct net_device *netdev;

	pr_debug("%s:start\n", __func__);

	if (ps3_compare_firmware_version(1, 6, 0) < 0)
		return 0;
	if (!card->vlan[GELIC_PORT_WIRELESS].tx)
		return 0;

	netdev = card->netdev[GELIC_PORT_WIRELESS];
	wl = port_wl(netdev_priv(netdev));

Annotation

Implementation Notes