Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1244816 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2015-10-12 17:30 +0200 |
| Last post | 2015-10-13 14:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 04/25] scsi: hisi_sas: add scsi host registration Arnd Bergmann <arnd@arndb.de> - 2015-10-12 17:30 +0200
Re: [PATCH 04/25] scsi: hisi_sas: add scsi host registration John Garry <john.garry@huawei.com> - 2015-10-13 11:30 +0200
Re: [PATCH 04/25] scsi: hisi_sas: add scsi host registration Arnd Bergmann <arnd@arndb.de> - 2015-10-13 14:20 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-10-12 17:30 +0200 |
| Subject | Re: [PATCH 04/25] scsi: hisi_sas: add scsi host registration |
| Message-ID | <qiNd0-2Xu-27@gated-at.bofh.it> |
On Monday 12 October 2015 23:20:16 John Garry wrote:
> +
> + shost = scsi_host_alloc(&hisi_sas_sht, sizeof(void *));
> + if (!shost)
> + return -ENOMEM;
> +
> + hisi_hba = hisi_sas_hba_alloc(pdev, shost, np);
> + if (!hisi_hba) {
> + rc = -ENOMEM;
> + goto err_out_ha;
> + }
You can collapse the allocations into one and just pass sizeof(*hisi_hba)
instead of sizeof(void *) above.
> + sha = SHOST_TO_SAS_HA(shost) = &hisi_hba->sha;
> + platform_set_drvdata(pdev, sha);
> +
> + phy_nr = port_nr = HISI_SAS_MAX_PHYS;
> +
> + arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL);
> + arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL);
> + if (!arr_phy || !arr_port)
> + return -ENOMEM;
And since these are fixed-size arrays, they can be moved in there as well.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2015-10-13 11:30 +0200 |
| Message-ID | <qj44e-2jZ-15@gated-at.bofh.it> |
| In reply to | #1244816 |
On 12/10/2015 16:21, Arnd Bergmann wrote:
> On Monday 12 October 2015 23:20:16 John Garry wrote:
>> +
>> + shost = scsi_host_alloc(&hisi_sas_sht, sizeof(void *));
>> + if (!shost)
>> + return -ENOMEM;
>> +
>> + hisi_hba = hisi_sas_hba_alloc(pdev, shost, np);
>> + if (!hisi_hba) {
>> + rc = -ENOMEM;
>> + goto err_out_ha;
>> + }
>
> You can collapse the allocations into one and just pass sizeof(*hisi_hba)
> instead of sizeof(void *) above.
>
Will address.
>
>> + sha = SHOST_TO_SAS_HA(shost) = &hisi_hba->sha;
>> + platform_set_drvdata(pdev, sha);
>> +
>> + phy_nr = port_nr = HISI_SAS_MAX_PHYS;
>> +
>> + arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL);
>> + arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL);
>> + if (!arr_phy || !arr_port)
>> + return -ENOMEM;
>
> And since these are fixed-size arrays, they can be moved in there as well.
>
In a later patch we set as follows:
phy_nr = port_nr = hisi_hba->n_phy;
You did say in our earlier private review that we could add statically
to hba strcut, but I commented that other vendors do similar so I would
wait for more input.
> Arnd
>
> .
>
Thanks,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-10-13 14:20 +0200 |
| Message-ID | <qj6IF-6iL-5@gated-at.bofh.it> |
| In reply to | #1245495 |
On Tuesday 13 October 2015 10:16:55 John Garry wrote: > > > > >> + sha = SHOST_TO_SAS_HA(shost) = &hisi_hba->sha; > >> + platform_set_drvdata(pdev, sha); > >> + > >> + phy_nr = port_nr = HISI_SAS_MAX_PHYS; > >> + > >> + arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL); > >> + arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL); > >> + if (!arr_phy || !arr_port) > >> + return -ENOMEM; > > > > And since these are fixed-size arrays, they can be moved in there as well. > > > In a later patch we set as follows: > phy_nr = port_nr = hisi_hba->n_phy; > > You did say in our earlier private review that we could add statically > to hba strcut, but I commented that other vendors do similar so I would > wait for more input. Ok, I forgot about that. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web