diff mbox

scsi: scsi_transport_fc: make the function argument as const

Message ID 1507906834-31150-1-git-send-email-bhumirks@gmail.com (mailing list archive)
State Deferred
Headers show

Commit Message

Bhumika Goyal Oct. 13, 2017, 3 p.m. UTC
This is a followup patch for: https://lkml.org/lkml/2017/10/13/476

Make the function argument of fc_attach_transport as const as it is
only stored in the const field 'f' (made const in the patch in the link)
of a fc_internal structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
This change allows some fc_function_template structures to be const.
I will send the patches for structure constification after this gets 
applied.

 drivers/scsi/scsi_transport_fc.c | 2 +-
 include/scsi/scsi_transport_fc.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

kernel test robot Oct. 15, 2017, 8:57 p.m. UTC | #1
Hi Bhumika,

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v4.14-rc4 next-20171013]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Bhumika-Goyal/scsi-scsi_transport_fc-make-the-function-argument-as-const/20171016-040132
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-x015-201742 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/scsi/scsi_transport_fc.c: In function 'fc_attach_transport':
>> drivers/scsi/scsi_transport_fc.c:2198:7: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     i->f = ft;
          ^

vim +/const +2198 drivers/scsi/scsi_transport_fc.c

5c44cd2af James.Smart@Emulex.Com 2005-06-10  2163  
^1da177e4 Linus Torvalds         2005-04-16  2164  struct scsi_transport_template *
b38779136 Bhumika Goyal          2017-10-13  2165  fc_attach_transport(const struct fc_function_template *ft)
^1da177e4 Linus Torvalds         2005-04-16  2166  {
^1da177e4 Linus Torvalds         2005-04-16  2167  	int count;
24669f75a Jes Sorensen           2006-01-16  2168  	struct fc_internal *i = kzalloc(sizeof(struct fc_internal),
24669f75a Jes Sorensen           2006-01-16  2169  					GFP_KERNEL);
^1da177e4 Linus Torvalds         2005-04-16  2170  
^1da177e4 Linus Torvalds         2005-04-16  2171  	if (unlikely(!i))
^1da177e4 Linus Torvalds         2005-04-16  2172  		return NULL;
^1da177e4 Linus Torvalds         2005-04-16  2173  
^1da177e4 Linus Torvalds         2005-04-16  2174  	i->t.target_attrs.ac.attrs = &i->starget_attrs[0];
^1da177e4 Linus Torvalds         2005-04-16  2175  	i->t.target_attrs.ac.class = &fc_transport_class.class;
^1da177e4 Linus Torvalds         2005-04-16  2176  	i->t.target_attrs.ac.match = fc_target_match;
^1da177e4 Linus Torvalds         2005-04-16  2177  	i->t.target_size = sizeof(struct fc_starget_attrs);
^1da177e4 Linus Torvalds         2005-04-16  2178  	transport_container_register(&i->t.target_attrs);
^1da177e4 Linus Torvalds         2005-04-16  2179  
^1da177e4 Linus Torvalds         2005-04-16  2180  	i->t.host_attrs.ac.attrs = &i->host_attrs[0];
^1da177e4 Linus Torvalds         2005-04-16  2181  	i->t.host_attrs.ac.class = &fc_host_class.class;
^1da177e4 Linus Torvalds         2005-04-16  2182  	i->t.host_attrs.ac.match = fc_host_match;
^1da177e4 Linus Torvalds         2005-04-16  2183  	i->t.host_size = sizeof(struct fc_host_attrs);
^1da177e4 Linus Torvalds         2005-04-16  2184  	if (ft->get_fc_host_stats)
^1da177e4 Linus Torvalds         2005-04-16  2185  		i->t.host_attrs.statistics = &fc_statistics_group;
^1da177e4 Linus Torvalds         2005-04-16  2186  	transport_container_register(&i->t.host_attrs);
^1da177e4 Linus Torvalds         2005-04-16  2187  
^1da177e4 Linus Torvalds         2005-04-16  2188  	i->rport_attr_cont.ac.attrs = &i->rport_attrs[0];
^1da177e4 Linus Torvalds         2005-04-16  2189  	i->rport_attr_cont.ac.class = &fc_rport_class.class;
^1da177e4 Linus Torvalds         2005-04-16  2190  	i->rport_attr_cont.ac.match = fc_rport_match;
^1da177e4 Linus Torvalds         2005-04-16  2191  	transport_container_register(&i->rport_attr_cont);
^1da177e4 Linus Torvalds         2005-04-16  2192  
a53eb5e06 James Smart            2007-04-27  2193  	i->vport_attr_cont.ac.attrs = &i->vport_attrs[0];
a53eb5e06 James Smart            2007-04-27  2194  	i->vport_attr_cont.ac.class = &fc_vport_class.class;
a53eb5e06 James Smart            2007-04-27  2195  	i->vport_attr_cont.ac.match = fc_vport_match;
a53eb5e06 James Smart            2007-04-27  2196  	transport_container_register(&i->vport_attr_cont);
a53eb5e06 James Smart            2007-04-27  2197  
^1da177e4 Linus Torvalds         2005-04-16 @2198  	i->f = ft;
^1da177e4 Linus Torvalds         2005-04-16  2199  
^1da177e4 Linus Torvalds         2005-04-16  2200  	/* Transport uses the shost workq for scsi scanning */
^1da177e4 Linus Torvalds         2005-04-16  2201  	i->t.create_work_queue = 1;
^1da177e4 Linus Torvalds         2005-04-16  2202  
e02f3f592 Christoph Hellwig      2006-01-13  2203  	i->t.user_scan = fc_user_scan;
5c44cd2af James.Smart@Emulex.Com 2005-06-10  2204  
^1da177e4 Linus Torvalds         2005-04-16  2205  	/*
^1da177e4 Linus Torvalds         2005-04-16  2206  	 * Setup SCSI Target Attributes.
^1da177e4 Linus Torvalds         2005-04-16  2207  	 */
^1da177e4 Linus Torvalds         2005-04-16  2208  	count = 0;
^1da177e4 Linus Torvalds         2005-04-16  2209  	SETUP_STARGET_ATTRIBUTE_RD(node_name);
^1da177e4 Linus Torvalds         2005-04-16  2210  	SETUP_STARGET_ATTRIBUTE_RD(port_name);
^1da177e4 Linus Torvalds         2005-04-16  2211  	SETUP_STARGET_ATTRIBUTE_RD(port_id);
^1da177e4 Linus Torvalds         2005-04-16  2212  
^1da177e4 Linus Torvalds         2005-04-16  2213  	BUG_ON(count > FC_STARGET_NUM_ATTRS);
^1da177e4 Linus Torvalds         2005-04-16  2214  
^1da177e4 Linus Torvalds         2005-04-16  2215  	i->starget_attrs[count] = NULL;
^1da177e4 Linus Torvalds         2005-04-16  2216  
^1da177e4 Linus Torvalds         2005-04-16  2217  
^1da177e4 Linus Torvalds         2005-04-16  2218  	/*
^1da177e4 Linus Torvalds         2005-04-16  2219  	 * Setup SCSI Host Attributes.
^1da177e4 Linus Torvalds         2005-04-16  2220  	 */
^1da177e4 Linus Torvalds         2005-04-16  2221  	count=0;
^1da177e4 Linus Torvalds         2005-04-16  2222  	SETUP_HOST_ATTRIBUTE_RD(node_name);
^1da177e4 Linus Torvalds         2005-04-16  2223  	SETUP_HOST_ATTRIBUTE_RD(port_name);
6b7281d0a Andreas Herrmann       2006-01-13  2224  	SETUP_HOST_ATTRIBUTE_RD(permanent_port_name);
^1da177e4 Linus Torvalds         2005-04-16  2225  	SETUP_HOST_ATTRIBUTE_RD(supported_classes);
^1da177e4 Linus Torvalds         2005-04-16  2226  	SETUP_HOST_ATTRIBUTE_RD(supported_fc4s);
^1da177e4 Linus Torvalds         2005-04-16  2227  	SETUP_HOST_ATTRIBUTE_RD(supported_speeds);
^1da177e4 Linus Torvalds         2005-04-16  2228  	SETUP_HOST_ATTRIBUTE_RD(maxframe_size);
a53eb5e06 James Smart            2007-04-27  2229  	if (ft->vport_create) {
a53eb5e06 James Smart            2007-04-27  2230  		SETUP_HOST_ATTRIBUTE_RD_NS(max_npiv_vports);
a53eb5e06 James Smart            2007-04-27  2231  		SETUP_HOST_ATTRIBUTE_RD_NS(npiv_vports_inuse);
a53eb5e06 James Smart            2007-04-27  2232  	}
^1da177e4 Linus Torvalds         2005-04-16  2233  	SETUP_HOST_ATTRIBUTE_RD(serial_number);
bb8ef587a Neerav Parikh          2012-01-22  2234  	SETUP_HOST_ATTRIBUTE_RD(manufacturer);
bb8ef587a Neerav Parikh          2012-01-22  2235  	SETUP_HOST_ATTRIBUTE_RD(model);
bb8ef587a Neerav Parikh          2012-01-22  2236  	SETUP_HOST_ATTRIBUTE_RD(model_description);
bb8ef587a Neerav Parikh          2012-01-22  2237  	SETUP_HOST_ATTRIBUTE_RD(hardware_version);
bb8ef587a Neerav Parikh          2012-01-22  2238  	SETUP_HOST_ATTRIBUTE_RD(driver_version);
bb8ef587a Neerav Parikh          2012-01-22  2239  	SETUP_HOST_ATTRIBUTE_RD(firmware_version);
bb8ef587a Neerav Parikh          2012-01-22  2240  	SETUP_HOST_ATTRIBUTE_RD(optionrom_version);
^1da177e4 Linus Torvalds         2005-04-16  2241  
^1da177e4 Linus Torvalds         2005-04-16  2242  	SETUP_HOST_ATTRIBUTE_RD(port_id);
^1da177e4 Linus Torvalds         2005-04-16  2243  	SETUP_HOST_ATTRIBUTE_RD(port_type);
^1da177e4 Linus Torvalds         2005-04-16  2244  	SETUP_HOST_ATTRIBUTE_RD(port_state);
^1da177e4 Linus Torvalds         2005-04-16  2245  	SETUP_HOST_ATTRIBUTE_RD(active_fc4s);
^1da177e4 Linus Torvalds         2005-04-16  2246  	SETUP_HOST_ATTRIBUTE_RD(speed);
^1da177e4 Linus Torvalds         2005-04-16  2247  	SETUP_HOST_ATTRIBUTE_RD(fabric_name);
016131b8f James Smart            2006-08-14  2248  	SETUP_HOST_ATTRIBUTE_RD(symbolic_name);
b8d082101 James Smart            2006-08-17  2249  	SETUP_HOST_ATTRIBUTE_RW(system_hostname);
^1da177e4 Linus Torvalds         2005-04-16  2250  
^1da177e4 Linus Torvalds         2005-04-16  2251  	/* Transport-managed attributes */
43ca910a9 Mike Christie          2010-09-15  2252  	SETUP_PRIVATE_HOST_ATTRIBUTE_RW(dev_loss_tmo);
^1da177e4 Linus Torvalds         2005-04-16  2253  	SETUP_PRIVATE_HOST_ATTRIBUTE_RW(tgtid_bind_type);
91ca7b01e Andrew Vasquez         2005-10-27  2254  	if (ft->issue_fc_host_lip)
91ca7b01e Andrew Vasquez         2005-10-27  2255  		SETUP_PRIVATE_HOST_ATTRIBUTE_RW(issue_lip);
a53eb5e06 James Smart            2007-04-27  2256  	if (ft->vport_create)
a53eb5e06 James Smart            2007-04-27  2257  		SETUP_PRIVATE_HOST_ATTRIBUTE_RW(vport_create);
a53eb5e06 James Smart            2007-04-27  2258  	if (ft->vport_delete)
a53eb5e06 James Smart            2007-04-27  2259  		SETUP_PRIVATE_HOST_ATTRIBUTE_RW(vport_delete);
^1da177e4 Linus Torvalds         2005-04-16  2260  
^1da177e4 Linus Torvalds         2005-04-16  2261  	BUG_ON(count > FC_HOST_NUM_ATTRS);
^1da177e4 Linus Torvalds         2005-04-16  2262  
^1da177e4 Linus Torvalds         2005-04-16  2263  	i->host_attrs[count] = NULL;
^1da177e4 Linus Torvalds         2005-04-16  2264  
^1da177e4 Linus Torvalds         2005-04-16  2265  	/*
^1da177e4 Linus Torvalds         2005-04-16  2266  	 * Setup Remote Port Attributes.
^1da177e4 Linus Torvalds         2005-04-16  2267  	 */
^1da177e4 Linus Torvalds         2005-04-16  2268  	count=0;
^1da177e4 Linus Torvalds         2005-04-16  2269  	SETUP_RPORT_ATTRIBUTE_RD(maxframe_size);
^1da177e4 Linus Torvalds         2005-04-16  2270  	SETUP_RPORT_ATTRIBUTE_RD(supported_classes);
^1da177e4 Linus Torvalds         2005-04-16  2271  	SETUP_RPORT_ATTRIBUTE_RW(dev_loss_tmo);
^1da177e4 Linus Torvalds         2005-04-16  2272  	SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(node_name);
^1da177e4 Linus Torvalds         2005-04-16  2273  	SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_name);
^1da177e4 Linus Torvalds         2005-04-16  2274  	SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_id);
^1da177e4 Linus Torvalds         2005-04-16  2275  	SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(roles);
^1da177e4 Linus Torvalds         2005-04-16  2276  	SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_state);
^1da177e4 Linus Torvalds         2005-04-16  2277  	SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(scsi_target_id);
0f29b966d James Smart            2006-08-18  2278  	SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(fast_io_fail_tmo);
^1da177e4 Linus Torvalds         2005-04-16  2279  
^1da177e4 Linus Torvalds         2005-04-16  2280  	BUG_ON(count > FC_RPORT_NUM_ATTRS);
^1da177e4 Linus Torvalds         2005-04-16  2281  
^1da177e4 Linus Torvalds         2005-04-16  2282  	i->rport_attrs[count] = NULL;
^1da177e4 Linus Torvalds         2005-04-16  2283  
a53eb5e06 James Smart            2007-04-27  2284  	/*
a53eb5e06 James Smart            2007-04-27  2285  	 * Setup Virtual Port Attributes.
a53eb5e06 James Smart            2007-04-27  2286  	 */
a53eb5e06 James Smart            2007-04-27  2287  	count=0;
a53eb5e06 James Smart            2007-04-27  2288  	SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_state);
a53eb5e06 James Smart            2007-04-27  2289  	SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_last_state);
a53eb5e06 James Smart            2007-04-27  2290  	SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(node_name);
a53eb5e06 James Smart            2007-04-27  2291  	SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(port_name);
a53eb5e06 James Smart            2007-04-27  2292  	SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(roles);
a53eb5e06 James Smart            2007-04-27  2293  	SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_type);
a53eb5e06 James Smart            2007-04-27  2294  	SETUP_VPORT_ATTRIBUTE_RW(symbolic_name);
a53eb5e06 James Smart            2007-04-27  2295  	SETUP_VPORT_ATTRIBUTE_WR(vport_delete);
a53eb5e06 James Smart            2007-04-27  2296  	SETUP_VPORT_ATTRIBUTE_WR(vport_disable);
a53eb5e06 James Smart            2007-04-27  2297  
a53eb5e06 James Smart            2007-04-27  2298  	BUG_ON(count > FC_VPORT_NUM_ATTRS);
a53eb5e06 James Smart            2007-04-27  2299  
a53eb5e06 James Smart            2007-04-27  2300  	i->vport_attrs[count] = NULL;
a53eb5e06 James Smart            2007-04-27  2301  
^1da177e4 Linus Torvalds         2005-04-16  2302  	return &i->t;
^1da177e4 Linus Torvalds         2005-04-16  2303  }
^1da177e4 Linus Torvalds         2005-04-16  2304  EXPORT_SYMBOL(fc_attach_transport);
^1da177e4 Linus Torvalds         2005-04-16  2305  

:::::: The code at line 2198 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 8c46a6d..fb30ede 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2162,7 +2162,7 @@  enum blk_eh_timer_return
 }
 
 struct scsi_transport_template *
-fc_attach_transport(struct fc_function_template *ft)
+fc_attach_transport(const struct fc_function_template *ft)
 {
 	int count;
 	struct fc_internal *i = kzalloc(sizeof(struct fc_internal),
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index e8644ee..60fff05 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -784,7 +784,7 @@  static inline void u64_to_wwn(u64 inm, u8 *wwn)
 }
 
 struct scsi_transport_template *fc_attach_transport(
-			struct fc_function_template *);
+			const struct fc_function_template *);
 void fc_release_transport(struct scsi_transport_template *);
 void fc_remove_host(struct Scsi_Host *);
 struct fc_rport *fc_remote_port_add(struct Scsi_Host *shost,