From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 06/10] mt76x2: move mt76x2_dev in mt76x02_util.h
Date: Wed, 3 Oct 2018 15:32:06 +0200 [thread overview]
Message-ID: <20181003133205.GA16914@redhat.com> (raw)
In-Reply-To: <5D5747FB-2C2E-481F-B361-2FA054E4D6E8@nbd.name>
On Wed, Oct 03, 2018 at 01:49:23PM +0200, Felix Fietkau wrote:
>
>
> > On 3. Oct 2018, at 13:12, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> >
> > On Wed, Oct 03, 2018 at 01:01:40PM +0200, Lorenzo Bianconi wrote:
> >>>
> >>> On Tue, Oct 02, 2018 at 12:19:04AM +0200, Lorenzo Bianconi wrote:
> >>>> Move mt76x2_dev in mt76x02_util.h and rename it in mt76x02_dev
> >>>> in order to be shared between mt76x2 and mt76x0 driver
> >>> <snip>
> >>>> +struct mt76x02_dev {
> >>>> + struct mt76_dev mt76; /* must be first */
> >>>> +
> >>>> + struct mac_address macaddr_list[8];
> >>>> +
> >>>> + struct mutex mutex;
> >>>> +
> >>>> + u8 txdone_seq;
> >>>> + DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status);
> >>>> +
> >>>> + struct sk_buff *rx_head;
> >>>> +
> >>>> + struct tasklet_struct tx_tasklet;
> >>>> + struct tasklet_struct pre_tbtt_tasklet;
> >>>> + struct delayed_work cal_work;
> >>>> + struct delayed_work mac_work;
> >>>> +
> >>>> + u32 aggr_stats[32];
> >>>> +
> >>>> + struct sk_buff *beacons[8];
> >>>> + u8 beacon_mask;
> >>>> + u8 beacon_data_mask;
> >>>> +
> >>>> + u8 tbtt_count;
> >>>> + u16 beacon_int;
> >>>> +
> >>>> + struct mt76x02_calibration cal;
> >>>> +
> >>>> + s8 target_power;
> >>>> + s8 target_power_delta[2];
> >>>> + bool enable_tpc;
> >>>> +
> >>>> + u8 coverage_class;
> >>>> + u8 slottime;
> >>>> +
> >>>> + struct mt76x02_dfs_pattern_detector dfs_pd;
> >>>> +};
> >>>> +
> >>> <snip>
> >>>> static bool
> >>>> -mt76x2_has_cal_free_data(struct mt76x2_dev *dev, u8 *efuse)
> >>>> +mt76x2_has_cal_free_data(struct mt76x02_dev *dev, u8 *efuse)
> >>>
> >>> I don't think this is right approach. I would rather prefer to have
> >>> common data structures embeded in mt76x2_dev and mt76x0_dev
> >>> structures to have chip sepcific fields/data separated.
> >>>
> >>
> >> The reason of this patch is that mt76x0_dev fields are already in mt76x2_dev
> >> so I guess there is no need to have different structures. Moreover in
> >> this way we can
> >> remove a lot of duplicated code between mt76x0 and mt76x2 drivers.
> >
> > But you can still create additional structures i.e.
> >
> > mt76x02_power {
> > s8 target_power;
> > s8 target_power_delta[2];
> > bool enable_tpc;
> > }
> >
> > mt76x02_conf {
> > u8 coverage_class;
> > u8 slottime;
> > }
> >
> > put them into mt76xN_dev and still remove dupicated code ?
> Quite often, mt76_dev would be needed as well for register access, which means extra parameters for a lot of functions.
> I think Lorenzo’s approach makes the code a lot more concise, and makes it easier to share more code between mt76x0 and mt76x2.
I think this could be solved very easly by container_of() macro if
there will be one mt76x02_dev struct just after mt76_dev.
Regerds
Stanislaw
next prev parent reply other threads:[~2018-10-03 13:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 22:19 [PATCH 06/10] mt76x2: move mt76x2_dev in mt76x02_util.h Lorenzo Bianconi
2018-10-03 10:43 ` Stanislaw Gruszka
2018-10-03 11:01 ` Lorenzo Bianconi
2018-10-03 11:12 ` Stanislaw Gruszka
2018-10-03 11:49 ` Felix Fietkau
2018-10-03 13:32 ` Stanislaw Gruszka [this message]
2018-10-03 13:51 ` Felix Fietkau
2018-10-03 13:55 ` Stanislaw Gruszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181003133205.GA16914@redhat.com \
--to=sgruszka@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).