From: Christopher Bostic <cbostic@linux.vnet.ibm.com>
To: Jeremy Kerr <jk@ozlabs.org>, joel@jms.id.au
Cc: openbmc@lists.ozlabs.org
Subject: Re: [PATCH linux dev-4.7 v2 1/7] drivers/fsi: Add hub master scan detect
Date: Wed, 22 Feb 2017 09:29:02 -0600 [thread overview]
Message-ID: <e881c9b5-0e3c-409b-1790-cd6df225c2b0@linux.vnet.ibm.com> (raw)
In-Reply-To: <cfc0ea35-fe2f-b733-ecfc-4a1d405e2a84@ozlabs.org>
On 2/21/17 7:02 PM, Jeremy Kerr wrote:
> Hi Chris,
>
>> @@ -252,7 +271,31 @@ static int fsi_slave_scan(struct fsi_slave *slave)
>> * Unused address areas are marked by a zero type value; this
>> * skips the defined address areas
>> */
>> - if (type != 0 && slots != 0) {
>> + if (type != 0) {
>> +
>> + if (type == FSI_ENGID_HUB_MASTER) {
> I'd split this into a separate part of the above 'if' statement. Or,
> convert it to a switch.
Hi Jeremy,
Will change.
>> + hub = kzalloc(sizeof(*hub), GFP_KERNEL);
>> + if (!hub)
>> + return -ENOMEM;
>> +
>> + hub->base = FSI_HUB_LINK_OFFSET;
>> + hub->control_regs = engine_addr;
>> + hub->slave = slave;
>> + rc = hub_master_init(hub);
>> +
>> + continue;
>> + }
>> + if (type == FSI_ENGID_HUB_LINK) {
>> + if (!hub)
>> + continue;
>> +
>> + hub->master.n_links++;
>> + if (hub->master.n_links ==
>> + (FSI_HUB_MASTER_MAX_LINKS * 2))
>> + rc = fsi_master_register(&hub->master);
>> +
>> + continue;
>> + }
> This logic doesn't make a lot of sense. You're counting the number of
> link slots, but then registering the master when that count hits a
> predefined number. I'd suggest either:
>
> - just setting n_links to the predefined number; or
>
> - keeping a separate variable for n_links, and then once we've finished
> scanning the configuration table (after the for loop)
>
> if (hub) {
> hub->n_links = conf_link_count / 2;
> fsi_master_register(&hub->master);
> }
>
> I'd much prefer the second option, as that actually uses the link count
> from the config table.
Will implement the second option
>> int fsi_master_register(struct fsi_master *master)
>> {
>> - if (!master || !master->dev)
>> + if (!master)
>> return -EINVAL;
> I'm worried if this is needed - we should be creating a device for all
> masters.
Will add a dev for struct fsi_master.
Thanks
> Cheers,
>
>
> Jeremy
>
next prev parent reply other threads:[~2017-02-22 15:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 21:50 [PATCH linux dev-4.7 v2 0/7] drivers/fsi: Add hub master Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 1/7] drivers/fsi: Add hub master scan detect Christopher Bostic
2017-02-22 1:02 ` Jeremy Kerr
2017-02-22 15:29 ` Christopher Bostic [this message]
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 2/7] drivers/fsi: Initialize hub master Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 3/7] drivers/fsi: Define hub master callbacks Christopher Bostic
2017-02-22 1:06 ` Jeremy Kerr
2017-02-22 16:33 ` Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 4/7] drivers/fsi: Move common read write ops into single function Christopher Bostic
2017-02-22 1:02 ` Joel Stanley
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 5/7] drivers/fsi: Add retry on bus error detect Christopher Bostic
2017-02-22 1:00 ` Joel Stanley
2017-02-22 16:34 ` Christopher Bostic
2017-02-22 22:36 ` Christopher Bostic
2017-02-22 1:13 ` Jeremy Kerr
2017-02-22 16:37 ` Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 6/7] drivers/fsi: Cleanup bus errors Christopher Bostic
2017-02-22 21:55 ` Jeremy Kerr
2017-02-22 22:51 ` Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 7/7] tools/testing/selftests: Add fsi command line tool Christopher Bostic
2017-02-22 1:08 ` [PATCH linux dev-4.7 v2 0/7] drivers/fsi: Add hub master Jeremy Kerr
2017-02-22 15:27 ` Christopher Bostic
2017-02-22 16:24 ` Andrew Geissler
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=e881c9b5-0e3c-409b-1790-cd6df225c2b0@linux.vnet.ibm.com \
--to=cbostic@linux.vnet.ibm.com \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.