Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9357c05 authored by Michael Buesch's avatar Michael Buesch Committed by John W. Linville
Browse files

[PATCH] bcm43xx: reduce the size of bcm43xx_private by removing unneeded members.

parent aae37781
Loading
Loading
Loading
Loading
+58 −36
Original line number Diff line number Diff line
@@ -556,33 +556,37 @@ struct bcm43xx_pio {

#define BCM43xx_MAX_80211_CORES		2

#define BCM43xx_COREFLAG_AVAILABLE	(1 << 0)
#define BCM43xx_COREFLAG_ENABLED	(1 << 1)
#define BCM43xx_COREFLAG_INITIALIZED	(1 << 2)

#ifdef CONFIG_BCM947XX
#define core_offset(bcm) (bcm)->current_core_offset
#else
#define core_offset(bcm) 0
#endif

/* Generic information about a core. */
struct bcm43xx_coreinfo {
	/** Driver internal flags. See BCM43xx_COREFLAG_* */
	u32 flags;
	u8 available:1,
	   enabled:1,
	   initialized:1;
	/** core_id ID number */
	u16 id;
	/** core_rev revision number */
	u8 rev;
	/** Index number for _switch_core() */
	u8 index;
	/* Pointer to the PHYinfo, which belongs to this core (if 80211 core) */
	struct bcm43xx_phyinfo *phy;
	/* Pointer to the RadioInfo, which belongs to this core (if 80211 core) */
	struct bcm43xx_radioinfo *radio;
	/* Pointer to the DMA rings, which belong to this core (if 80211 core) */
	struct bcm43xx_dma *dma;
	/* Pointer to the PIO queues, which belong to this core (if 80211 core) */
	struct bcm43xx_pio *pio;
};

/* Additional information for each 80211 core. */
struct bcm43xx_coreinfo_80211 {
	/* PHY device. */
	struct bcm43xx_phyinfo phy;
	/* Radio device. */
	struct bcm43xx_radioinfo radio;
	union {
		/* DMA context. */
		struct bcm43xx_dma dma;
		/* PIO context. */
		struct bcm43xx_pio pio;
	};
};

/* Context information for a noise calculation (Link Quality). */
@@ -652,7 +656,7 @@ struct bcm43xx_private {
#define BCM43xx_NR_LEDS		4
	struct bcm43xx_led leds[BCM43xx_NR_LEDS];

	/* The currently active core. NULL if not initialized, yet. */
	/* The currently active core. */
	struct bcm43xx_coreinfo *current_core;
#ifdef CONFIG_BCM947XX
	/** current core memory offset */
@@ -665,18 +669,15 @@ struct bcm43xx_private {
	 */
	struct bcm43xx_coreinfo core_chipcommon;
	struct bcm43xx_coreinfo core_pci;
	struct bcm43xx_coreinfo core_v90;
	struct bcm43xx_coreinfo core_pcmcia;
	struct bcm43xx_coreinfo core_ethernet;
	struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ];
	/* Info about the PHY for each 80211 core. */
	struct bcm43xx_phyinfo phy[ BCM43xx_MAX_80211_CORES ];
	/* Info about the Radio for each 80211 core. */
	struct bcm43xx_radioinfo radio[ BCM43xx_MAX_80211_CORES ];
	/* DMA */
	struct bcm43xx_dma dma[ BCM43xx_MAX_80211_CORES ];
	/* PIO */
	struct bcm43xx_pio pio[ BCM43xx_MAX_80211_CORES ];
	/* Additional information, specific to the 80211 cores. */
	struct bcm43xx_coreinfo_80211 core_80211_ext[ BCM43xx_MAX_80211_CORES ];
	/* Index of the current 80211 core. If current_core is not
	 * an 80211 core, this is -1.
	 */
	int current_80211_core_idx;
	/* Number of available 80211 cores. */
	int nr_80211_available;

	u32 chipcommon_capabilities;

@@ -769,18 +770,39 @@ int bcm43xx_using_pio(struct bcm43xx_private *bcm)
# error "Using neither DMA nor PIO? Confused..."
#endif


/* Helper functions to access data structures private to the 80211 cores.
 * Note that we _must_ have an 80211 core mapped when calling
 * any of these functions.
 */
static inline
int bcm43xx_num_80211_cores(struct bcm43xx_private *bcm)
struct bcm43xx_pio * bcm43xx_current_pio(struct bcm43xx_private *bcm)
{
	int i, cnt = 0;

	for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
		if (bcm->core_80211[i].flags & BCM43xx_COREFLAG_AVAILABLE)
			cnt++;
	assert(bcm43xx_using_pio(bcm));
	assert(bcm->current_80211_core_idx >= 0);
	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].pio);
}

	return cnt;
static inline
struct bcm43xx_dma * bcm43xx_current_dma(struct bcm43xx_private *bcm)
{
	assert(!bcm43xx_using_pio(bcm));
	assert(bcm->current_80211_core_idx >= 0);
	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].dma);
}
static inline
struct bcm43xx_phyinfo * bcm43xx_current_phy(struct bcm43xx_private *bcm)
{
	assert(bcm->current_80211_core_idx >= 0);
	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].phy);
}
static inline
struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm)
{
	assert(bcm->current_80211_core_idx >= 0);
	assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
	return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio);
}

/* Are we running in init_board() context? */
+2 −5
Original line number Diff line number Diff line
@@ -104,16 +104,13 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
	fappend("\nCores:\n");
#define fappend_core(name, info) fappend("core \"" name "\" %s, %s, id: 0x%04x, "	\
					 "rev: 0x%02x, index: 0x%02x\n",		\
					 (info).flags & BCM43xx_COREFLAG_AVAILABLE	\
					 (info).available				\
						? "available" : "nonavailable",		\
					 (info).flags & BCM43xx_COREFLAG_ENABLED	\
					 (info).enabled					\
						? "enabled" : "disabled",		\
					 (info).id, (info).rev, (info).index)
	fappend_core("CHIPCOMMON", bcm->core_chipcommon);
	fappend_core("PCI", bcm->core_pci);
	fappend_core("V90", bcm->core_v90);
	fappend_core("PCMCIA", bcm->core_pcmcia);
	fappend_core("ETHERNET", bcm->core_ethernet);
	fappend_core("first 80211", bcm->core_80211[0]);
	fappend_core("second 80211", bcm->core_80211[1]);
#undef fappend_core
+5 −4
Original line number Diff line number Diff line
@@ -531,7 +531,7 @@ static void bcm43xx_destroy_dmaring(struct bcm43xx_dmaring *ring)

void bcm43xx_dma_free(struct bcm43xx_private *bcm)
{
	struct bcm43xx_dma *dma = bcm->current_core->dma;
	struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);

	bcm43xx_destroy_dmaring(dma->rx_ring1);
	dma->rx_ring1 = NULL;
@@ -549,7 +549,7 @@ void bcm43xx_dma_free(struct bcm43xx_private *bcm)

int bcm43xx_dma_init(struct bcm43xx_private *bcm)
{
	struct bcm43xx_dma *dma = bcm->current_core->dma;
	struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);
	struct bcm43xx_dmaring *ring;
	int err = -ENOMEM;

@@ -652,7 +652,7 @@ static
struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm,
				      u16 cookie, int *slot)
{
	struct bcm43xx_dma *dma = bcm->current_core->dma;
	struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);
	struct bcm43xx_dmaring *ring = NULL;

	switch (cookie & 0xF000) {
@@ -755,7 +755,7 @@ int bcm43xx_dma_tx(struct bcm43xx_private *bcm,
	 * the device to send the stuff.
	 * Note that this is called from atomic context.
	 */
	struct bcm43xx_dmaring *ring = bcm->current_core->dma->tx_ring1;
	struct bcm43xx_dmaring *ring = bcm43xx_current_dma(bcm)->tx_ring1;
	u8 i;
	struct sk_buff *skb;

@@ -784,6 +784,7 @@ int bcm43xx_dma_tx(struct bcm43xx_private *bcm,
void bcm43xx_dma_handle_xmitstatus(struct bcm43xx_private *bcm,
				   struct bcm43xx_xmitstatus *status)
{
	struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);
	struct bcm43xx_dmaring *ring;
	struct bcm43xx_dmadesc *desc;
	struct bcm43xx_dmadesc_meta *meta;
+2 −2
Original line number Diff line number Diff line
@@ -314,7 +314,7 @@ const u16 bcm43xx_ilt_sigmasqr2[BCM43xx_ILT_SIGMASQR_SIZE] = {

void bcm43xx_ilt_write(struct bcm43xx_private *bcm, u16 offset, u16 val)
{
	if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) {
	if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) {
		bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset);
		mmiowb();
		bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_DATA1, val);
@@ -327,7 +327,7 @@ void bcm43xx_ilt_write(struct bcm43xx_private *bcm, u16 offset, u16 val)

u16 bcm43xx_ilt_read(struct bcm43xx_private *bcm, u16 offset)
{
	if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) {
	if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) {
		bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset);
		return bcm43xx_phy_read(bcm, BCM43xx_PHY_ILT_A_DATA1);
	} else {
+2 −2
Original line number Diff line number Diff line
@@ -171,8 +171,8 @@ void bcm43xx_leds_exit(struct bcm43xx_private *bcm)
void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity)
{
	struct bcm43xx_led *led;
	struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
	struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
	struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
	struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
	const int transferring = (jiffies - bcm->stats.last_tx) < BCM43xx_LED_XFER_THRES;
	int i, turn_on;
	unsigned long interval = 0;
Loading