diff mbox

[04/12] PCI: qcom: account for const type of of_device_id.data

Message ID 1514899688-27844-5-git-send-email-Julia.Lawall@lip6.fr (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Julia Lawall Jan. 2, 2018, 1:28 p.m. UTC
This driver creates various const structures that it stores in the
data field of an of_device_id array.

Adding const to the declaration of the location that receives the
const value from the data field ensures that the compiler will
continue to check that the value is not modified.  Furthermore, the
const-discarding cast on the extraction from the data field is no
longer needed.

Done using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/pci/dwc/pcie-qcom.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lorenzo Pieralisi Jan. 3, 2018, 12:22 p.m. UTC | #1
On Tue, Jan 02, 2018 at 02:28:00PM +0100, Julia Lawall wrote:
> This driver creates various const structures that it stores in the
> data field of an of_device_id array.
> 
> Adding const to the declaration of the location that receives the
> const value from the data field ensures that the compiler will
> continue to check that the value is not modified.  Furthermore, the
> const-discarding cast on the extraction from the data field is no
> longer needed.
> 
> Done using Coccinelle.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/pci/dwc/pcie-qcom.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Hi Julia,

I am happy to take this patch through the PCI tree unless you see a
problem with that, please let me know.

Thanks,
Lorenzo

> diff -u -p a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
> --- a/drivers/pci/dwc/pcie-qcom.c
> +++ b/drivers/pci/dwc/pcie-qcom.c
> @@ -171,7 +171,7 @@ struct qcom_pcie {
>  	union qcom_pcie_resources res;
>  	struct phy *phy;
>  	struct gpio_desc *reset;
> -	struct qcom_pcie_ops *ops;
> +	const struct qcom_pcie_ops *ops;
>  };
>  
>  #define to_qcom_pcie(x)		dev_get_drvdata((x)->dev)
> @@ -1234,7 +1234,7 @@ static int qcom_pcie_probe(struct platfo
>  
>  	pcie->pci = pci;
>  
> -	pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
> +	pcie->ops = of_device_get_match_data(dev);
>  
>  	pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
>  	if (IS_ERR(pcie->reset))
>
Stanimir Varbanov Jan. 3, 2018, 12:38 p.m. UTC | #2
Hi Lorenzo,

On 01/03/2018 02:22 PM, Lorenzo Pieralisi wrote:
> On Tue, Jan 02, 2018 at 02:28:00PM +0100, Julia Lawall wrote:
>> This driver creates various const structures that it stores in the
>> data field of an of_device_id array.
>>
>> Adding const to the declaration of the location that receives the
>> const value from the data field ensures that the compiler will
>> continue to check that the value is not modified.  Furthermore, the
>> const-discarding cast on the extraction from the data field is no
>> longer needed.
>>
>> Done using Coccinelle.
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> ---
>>  drivers/pci/dwc/pcie-qcom.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Hi Julia,

Probably that is addressed to me :)

> 
> I am happy to take this patch through the PCI tree unless you see a
> problem with that, please let me know.

The patch looks fine.

Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Julia Lawall Jan. 3, 2018, 12:38 p.m. UTC | #3
On Wed, 3 Jan 2018, Lorenzo Pieralisi wrote:

> On Tue, Jan 02, 2018 at 02:28:00PM +0100, Julia Lawall wrote:
> > This driver creates various const structures that it stores in the
> > data field of an of_device_id array.
> >
> > Adding const to the declaration of the location that receives the
> > const value from the data field ensures that the compiler will
> > continue to check that the value is not modified.  Furthermore, the
> > const-discarding cast on the extraction from the data field is no
> > longer needed.
> >
> > Done using Coccinelle.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > ---
> >  drivers/pci/dwc/pcie-qcom.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Hi Julia,
>
> I am happy to take this patch through the PCI tree unless you see a
> problem with that, please let me know.

Please take it.  Thanks.

julia

>
> Thanks,
> Lorenzo
>
> > diff -u -p a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
> > --- a/drivers/pci/dwc/pcie-qcom.c
> > +++ b/drivers/pci/dwc/pcie-qcom.c
> > @@ -171,7 +171,7 @@ struct qcom_pcie {
> >  	union qcom_pcie_resources res;
> >  	struct phy *phy;
> >  	struct gpio_desc *reset;
> > -	struct qcom_pcie_ops *ops;
> > +	const struct qcom_pcie_ops *ops;
> >  };
> >
> >  #define to_qcom_pcie(x)		dev_get_drvdata((x)->dev)
> > @@ -1234,7 +1234,7 @@ static int qcom_pcie_probe(struct platfo
> >
> >  	pcie->pci = pci;
> >
> > -	pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
> > +	pcie->ops = of_device_get_match_data(dev);
> >
> >  	pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
> >  	if (IS_ERR(pcie->reset))
> >
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Lorenzo Pieralisi Jan. 3, 2018, 6:23 p.m. UTC | #4
On Wed, Jan 03, 2018 at 01:38:27PM +0100, Julia Lawall wrote:
> 
> 
> On Wed, 3 Jan 2018, Lorenzo Pieralisi wrote:
> 
> > On Tue, Jan 02, 2018 at 02:28:00PM +0100, Julia Lawall wrote:
> > > This driver creates various const structures that it stores in the
> > > data field of an of_device_id array.
> > >
> > > Adding const to the declaration of the location that receives the
> > > const value from the data field ensures that the compiler will
> > > continue to check that the value is not modified.  Furthermore, the
> > > const-discarding cast on the extraction from the data field is no
> > > longer needed.
> > >
> > > Done using Coccinelle.
> > >
> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > >
> > > ---
> > >  drivers/pci/dwc/pcie-qcom.c |    4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > Hi Julia,
> >
> > I am happy to take this patch through the PCI tree unless you see a
> > problem with that, please let me know.
> 
> Please take it.  Thanks.

Applied to pci/dwc for v4.16, thanks.

Lorenzo

> julia
> 
> >
> > Thanks,
> > Lorenzo
> >
> > > diff -u -p a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
> > > --- a/drivers/pci/dwc/pcie-qcom.c
> > > +++ b/drivers/pci/dwc/pcie-qcom.c
> > > @@ -171,7 +171,7 @@ struct qcom_pcie {
> > >  	union qcom_pcie_resources res;
> > >  	struct phy *phy;
> > >  	struct gpio_desc *reset;
> > > -	struct qcom_pcie_ops *ops;
> > > +	const struct qcom_pcie_ops *ops;
> > >  };
> > >
> > >  #define to_qcom_pcie(x)		dev_get_drvdata((x)->dev)
> > > @@ -1234,7 +1234,7 @@ static int qcom_pcie_probe(struct platfo
> > >
> > >  	pcie->pci = pci;
> > >
> > > -	pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
> > > +	pcie->ops = of_device_get_match_data(dev);
> > >
> > >  	pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
> > >  	if (IS_ERR(pcie->reset))
> > >
> > --
> > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
diff mbox

Patch

diff -u -p a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
--- a/drivers/pci/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c
@@ -171,7 +171,7 @@  struct qcom_pcie {
 	union qcom_pcie_resources res;
 	struct phy *phy;
 	struct gpio_desc *reset;
-	struct qcom_pcie_ops *ops;
+	const struct qcom_pcie_ops *ops;
 };
 
 #define to_qcom_pcie(x)		dev_get_drvdata((x)->dev)
@@ -1234,7 +1234,7 @@  static int qcom_pcie_probe(struct platfo
 
 	pcie->pci = pci;
 
-	pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
+	pcie->ops = of_device_get_match_data(dev);
 
 	pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
 	if (IS_ERR(pcie->reset))