Re: [PATCH] media: add GFP flag to media_*() that could get called in atomic context
On Sat, Mar 12, 2016 at 06:48:09PM -0700, Shuah Khan wrote: > Add GFP flags to media_create_pad_link(), media_create_intf_link(), > media_devnode_create(), and media_add_link() that could get called > in atomic context to allow callers to pass in the right flags for > memory allocation. > > tree-wide driver changes for media_*() GFP flags change: > Change drivers to add gfpflags to interffaces, media_create_pad_link(), > media_create_intf_link() and media_devnode_create(). > in two cases (media_add_link,media_devnode_create) it is passing in gfpflags but then checking for in_atomic() and in case it is, dumping stack - so does it make sense in those cases to allow GFP_ATOMIC to be passed in ? could not figure out why that would be needed (current callers in media-entity.c do not seem to be under a spin_lock). and in a few cases there seems to be a little glitch with indentation dvb_create_media_graph __fimc_md_create_fimc_sink_links __fimc_md_create_fimc_is_links vsp1_create_sink_links v4l2_mc_create_media_graph vpfe_ipipeif_register_entities thx! hofrat > Signed-off-by: Shuah Khan > Suggested-by: Mauro Carvalho Chehab > --- > Ran through kbuild-all compile testing. > Tested the changes in Win-TV HVR-950Q device > > drivers/media/dvb-core/dvbdev.c| 26 +++- > drivers/media/i2c/s5c73m3/s5c73m3-core.c | 6 ++- > drivers/media/i2c/s5k5baf.c| 3 +- > drivers/media/i2c/smiapp/smiapp-core.c | 3 +- > drivers/media/i2c/tvp5150.c| 3 +- > drivers/media/media-entity.c | 30 -- > drivers/media/platform/exynos4-is/media-dev.c | 19 + > drivers/media/platform/omap3isp/isp.c | 47 > ++ > drivers/media/platform/s3c-camif/camif-core.c | 4 +- > drivers/media/platform/vsp1/vsp1_drm.c | 6 +-- > drivers/media/platform/vsp1/vsp1_drv.c | 9 +++-- > drivers/media/platform/xilinx/xilinx-vipp.c| 4 +- > drivers/media/usb/au0828/au0828-core.c | 3 +- > drivers/media/usb/uvc/uvc_entity.c | 2 +- > drivers/media/v4l2-core/v4l2-dev.c | 5 ++- > drivers/media/v4l2-core/v4l2-device.c | 3 +- > drivers/media/v4l2-core/v4l2-mc.c | 25 +++- > drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 3 +- > drivers/staging/media/davinci_vpfe/dm365_isif.c| 2 +- > drivers/staging/media/davinci_vpfe/dm365_resizer.c | 10 +++-- > .../staging/media/davinci_vpfe/vpfe_mc_capture.c | 10 ++--- > drivers/staging/media/omap4iss/iss.c | 17 +--- > drivers/staging/media/omap4iss/iss_csi2.c | 6 ++- > drivers/staging/media/omap4iss/iss_ipipeif.c | 3 +- > drivers/staging/media/omap4iss/iss_resizer.c | 3 +- > include/media/media-entity.h | 9 +++-- > sound/usb/media.c | 15 --- > 27 files changed, 170 insertions(+), 106 deletions(-) > > diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c > index e1684c5..57f3e1e 100644 > --- a/drivers/media/dvb-core/dvbdev.c > +++ b/drivers/media/dvb-core/dvbdev.c > @@ -399,7 +399,8 @@ static int dvb_register_media_device(struct dvb_device > *dvbdev, > > dvbdev->intf_devnode = media_devnode_create(dvbdev->adapter->mdev, > intf_type, 0, > - DVB_MAJOR, minor); > + DVB_MAJOR, minor, > + GFP_KERNEL); > > if (!dvbdev->intf_devnode) > return -ENOMEM; > @@ -416,7 +417,7 @@ static int dvb_register_media_device(struct dvb_device > *dvbdev, > return 0; > > link = media_create_intf_link(dvbdev->entity, > &dvbdev->intf_devnode->intf, > - MEDIA_LNK_FL_ENABLED); > + MEDIA_LNK_FL_ENABLED, GFP_KERNEL); > if (!link) > return -ENOMEM; > #endif > @@ -558,7 +559,8 @@ static int dvb_create_io_intf_links(struct dvb_adapter > *adap, > if (strncmp(entity->name, name, strlen(name))) > continue; > link = media_create_intf_link(entity, intf, > - MEDIA_LNK_FL_ENABLED); > + MEDIA_LNK_FL_ENABLED, > + GFP_KERNEL); > if (!link) > return -ENOMEM; > } > @@ -680,7 +682,8 @@ int dvb_create_media_graph(struct dvb_adapter *adap, > } > if (demux && ca) { > ret = media_create_pad_link(demux, 1, ca, > - 0, MEDIA_LNK
Re: [PATCH] media: add GFP flag to media_*() that could get called in atomic context
Em Sat, 12 Mar 2016 18:48:09 -0700 Shuah Khan escreveu: > Add GFP flags to media_create_pad_link(), media_create_intf_link(), > media_devnode_create(), and media_add_link() that could get called > in atomic context to allow callers to pass in the right flags for > memory allocation. > > tree-wide driver changes for media_*() GFP flags change: > Change drivers to add gfpflags to interffaces, media_create_pad_link(), > media_create_intf_link() and media_devnode_create(). > > Signed-off-by: Shuah Khan > Suggested-by: Mauro Carvalho Chehab Patches look OK to me[1], provided that a followup patch is changes some of the callers to use GFP_ATOMIC. I'll wait for such patch before merging this one. Regards, Mauro [1] but see Nicholas comments about indentation. > --- > Ran through kbuild-all compile testing. > Tested the changes in Win-TV HVR-950Q device > > drivers/media/dvb-core/dvbdev.c| 26 +++- > drivers/media/i2c/s5c73m3/s5c73m3-core.c | 6 ++- > drivers/media/i2c/s5k5baf.c| 3 +- > drivers/media/i2c/smiapp/smiapp-core.c | 3 +- > drivers/media/i2c/tvp5150.c| 3 +- > drivers/media/media-entity.c | 30 -- > drivers/media/platform/exynos4-is/media-dev.c | 19 + > drivers/media/platform/omap3isp/isp.c | 47 > ++ > drivers/media/platform/s3c-camif/camif-core.c | 4 +- > drivers/media/platform/vsp1/vsp1_drm.c | 6 +-- > drivers/media/platform/vsp1/vsp1_drv.c | 9 +++-- > drivers/media/platform/xilinx/xilinx-vipp.c| 4 +- > drivers/media/usb/au0828/au0828-core.c | 3 +- > drivers/media/usb/uvc/uvc_entity.c | 2 +- > drivers/media/v4l2-core/v4l2-dev.c | 5 ++- > drivers/media/v4l2-core/v4l2-device.c | 3 +- > drivers/media/v4l2-core/v4l2-mc.c | 25 +++- > drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 3 +- > drivers/staging/media/davinci_vpfe/dm365_isif.c| 2 +- > drivers/staging/media/davinci_vpfe/dm365_resizer.c | 10 +++-- > .../staging/media/davinci_vpfe/vpfe_mc_capture.c | 10 ++--- > drivers/staging/media/omap4iss/iss.c | 17 +--- > drivers/staging/media/omap4iss/iss_csi2.c | 6 ++- > drivers/staging/media/omap4iss/iss_ipipeif.c | 3 +- > drivers/staging/media/omap4iss/iss_resizer.c | 3 +- > include/media/media-entity.h | 9 +++-- > sound/usb/media.c | 15 --- > 27 files changed, 170 insertions(+), 106 deletions(-) > > diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c > index e1684c5..57f3e1e 100644 > --- a/drivers/media/dvb-core/dvbdev.c > +++ b/drivers/media/dvb-core/dvbdev.c > @@ -399,7 +399,8 @@ static int dvb_register_media_device(struct dvb_device > *dvbdev, > > dvbdev->intf_devnode = media_devnode_create(dvbdev->adapter->mdev, > intf_type, 0, > - DVB_MAJOR, minor); > + DVB_MAJOR, minor, > + GFP_KERNEL); > > if (!dvbdev->intf_devnode) > return -ENOMEM; > @@ -416,7 +417,7 @@ static int dvb_register_media_device(struct dvb_device > *dvbdev, > return 0; > > link = media_create_intf_link(dvbdev->entity, > &dvbdev->intf_devnode->intf, > - MEDIA_LNK_FL_ENABLED); > + MEDIA_LNK_FL_ENABLED, GFP_KERNEL); > if (!link) > return -ENOMEM; > #endif > @@ -558,7 +559,8 @@ static int dvb_create_io_intf_links(struct dvb_adapter > *adap, > if (strncmp(entity->name, name, strlen(name))) > continue; > link = media_create_intf_link(entity, intf, > - MEDIA_LNK_FL_ENABLED); > + MEDIA_LNK_FL_ENABLED, > + GFP_KERNEL); > if (!link) > return -ENOMEM; > } > @@ -680,7 +682,8 @@ int dvb_create_media_graph(struct dvb_adapter *adap, > } > if (demux && ca) { > ret = media_create_pad_link(demux, 1, ca, > - 0, MEDIA_LNK_FL_ENABLED); > + 0, MEDIA_LNK_FL_ENABLED, > + GFP_KERNEL); > if (ret) > return -ENOMEM; > } > @@ -693,7 +696,8 @@ int dvb_create_media_graph(struct dvb_adapter *adap, > strlen(DVR_TSOUT))) { >
[PATCH] rtl8188eu: Remove license paragraph with mailing address
This fixes the issue reported by checkpatch.pl: "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL." in all files for the rtl8188eu driver. Signed-off-by: Kyle Kuffermann --- drivers/staging/rtl8188eu/core/rtw_ap.c | 5 - drivers/staging/rtl8188eu/core/rtw_cmd.c | 5 - drivers/staging/rtl8188eu/core/rtw_debug.c| 5 - drivers/staging/rtl8188eu/core/rtw_efuse.c| 5 - drivers/staging/rtl8188eu/core/rtw_ieee80211.c| 5 - drivers/staging/rtl8188eu/core/rtw_ioctl_set.c| 5 - drivers/staging/rtl8188eu/core/rtw_mlme.c | 5 - drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 5 - drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 5 - drivers/staging/rtl8188eu/core/rtw_recv.c | 5 - drivers/staging/rtl8188eu/core/rtw_rf.c | 5 - drivers/staging/rtl8188eu/core/rtw_security.c | 5 - drivers/staging/rtl8188eu/core/rtw_sreset.c | 5 - drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 5 - drivers/staging/rtl8188eu/core/rtw_wlan_util.c| 5 - drivers/staging/rtl8188eu/core/rtw_xmit.c | 5 - drivers/staging/rtl8188eu/hal/bb_cfg.c| 5 - drivers/staging/rtl8188eu/hal/fw.c| 4 drivers/staging/rtl8188eu/hal/hal_com.c | 5 - drivers/staging/rtl8188eu/hal/hal_intf.c | 5 - drivers/staging/rtl8188eu/hal/mac_cfg.c | 5 - drivers/staging/rtl8188eu/hal/odm.c | 5 - drivers/staging/rtl8188eu/hal/odm_HWConfig.c | 5 - drivers/staging/rtl8188eu/hal/odm_RTL8188E.c | 5 - drivers/staging/rtl8188eu/hal/phy.c | 5 - drivers/staging/rtl8188eu/hal/pwrseq.c| 5 - drivers/staging/rtl8188eu/hal/pwrseqcmd.c | 4 drivers/staging/rtl8188eu/hal/rf.c| 4 drivers/staging/rtl8188eu/hal/rf_cfg.c| 5 - drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c | 5 - drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 5 - drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 5 - drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 5 - drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c | 5 - drivers/staging/rtl8188eu/hal/rtl8188eu_led.c | 5 - drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c| 5 - drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c| 5 - drivers/staging/rtl8188eu/hal/usb_halinit.c | 5 - drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h| 5 - drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h| 5 - drivers/staging/rtl8188eu/include/HalHWImg8188E_FW.h | 5 - drivers/staging/rtl8188eu/include/HalVerDef.h | 5 - drivers/staging/rtl8188eu/include/basic_types.h | 5 - drivers/staging/rtl8188eu/include/drv_types.h | 5 - drivers/staging/rtl8188eu/include/fw.h| 4 drivers/staging/rtl8188eu/include/hal_com.h | 5 - drivers/staging/rtl8188eu/include/hal_intf.h | 5 - drivers/staging/rtl8188eu/include/ieee80211.h | 5 - drivers/staging/rtl8188eu/include/mlme_osdep.h| 5 - drivers/staging/rtl8188eu/include/mp_custom_oid.h | 5 - drivers/staging/rtl8188eu/include/odm.h | 5 - drivers/staging/rtl8188eu/include/odm_HWConfig.h | 4 drivers/staging/rtl8188eu/include/odm_RTL8188E.h | 5 - drivers/staging/rtl8188eu/include/odm_RegDefine11N.h | 5 - drivers/staging/rtl8188eu/include/odm_debug.h | 5 - drivers/staging/rtl8188eu/include/odm_precomp.h | 5 - drivers/staging/rtl8188eu/include/odm_reg.h | 5 - drivers/staging/rtl8188eu/include/odm_types.h | 5 - drivers/staging/rtl8188eu/include/osdep_intf.h| 5 - drivers/staging/rtl8188eu/include/osdep_service.h | 5 - drivers/staging/rtl8188eu/include/pwrseq.h| 5 - drivers/staging/rtl8188eu/include/pwrseqcmd.h | 5 - drivers/staging/rtl8188eu/include/recv_osdep.h| 5 - drivers/staging/rtl8188eu/include/rtl8188e_cmd.h | 5 - drivers/staging/rtl8188eu/include/rtl8188e_dm.h | 5 - drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 5 - drivers/staging/rtl8188eu/include/rtl8188e_led.h | 5 - drivers/staging/rtl8188eu/include/rtl8188e_recv.h | 5 - drivers/staging/rtl8188eu/include/rtl8188e_spec.h | 4 drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 5 - drivers/staging/rtl8188eu/include/rtw_android.h | 5 - d
Hello dear
Dear Friend, Compliments of the day and i hope that this email meets you well, first of all let me begin by introducing myself. I am Bernard Madoff, an American convicts, stockbroker, investment adviser, and financier. I was arrested in December 11, 2008, but before the arrest, I was the founder of Wall Street firm, Bernard L. Madoff Investment Securities LLC in 1960 an also the Chairman of WallStreet Firm. On March 12, 2009, I pleaded guilty to eleven federal felonies and admitted that i turned my wealth management business into a massive Ponzi scheme, which defrauded thousands of investors of their billions of dollars in the USA. My case was in court trial until June 29, 2009, and I was sentenced to 150 years in prison. I am presently serving my jail term, and right now I am battling with Kidney Cancer and waiting for my death. The US government has confiscated all my assets, my wife has left me, and my two sons are dead. I have lost everything that is of value to in life, even my freedom, and my life is worthless and nothing matters to me again. Now i come to learn the lessons of life and i have thus accepted Jesus Christ as my lord and personal savior and I regret my past and thus very remorseful of my wrong doings, by betraying the people who entrusted me with fund. I am now a born again Christian and have repented from my sins. I still have in my possession a total sum of €100,000.000.00 (One Hundred Million Euro), which the USA Government is not aware of because the fund is hidden far away from American continent. I have determined to share this wealth and give back to people of the world , i want to give it to charity ,to the less privilege and provide homes to homeless, people who are facing hardship in life, Natural disaster and war victims of Middle East and Africa respectively. Motherless homes, old people's home etc I am writing you to assist me in distributing this fund, through charity means and give life to the less privileged ones. I have gone through your profiles during my search for someone that i could assign and commit this mission to and i am rightly convinced that somebody of your statue will not stoop so low to derail in this kind of social and humanitarian task for no reason whatsoever hence am contacting you. My instincts and fate has led me to you. You can read more details about me by typing my name in google.com (Bernard L Madoff). I will be waiting to hear from you any moment from now. May the peace of the lord be with you and your family. Regards Bernard Madoff ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Hello dear
Dear Friend, Compliments of the day and i hope that this email meets you well, first of all let me begin by introducing myself. I am Bernard Madoff, an American convicts, stockbroker, investment adviser, and financier. I was arrested in December 11, 2008, but before the arrest, I was the founder of Wall Street firm, Bernard L. Madoff Investment Securities LLC in 1960 an also the Chairman of WallStreet Firm. On March 12, 2009, I pleaded guilty to eleven federal felonies and admitted that i turned my wealth management business into a massive Ponzi scheme, which defrauded thousands of investors of their billions of dollars in the USA. My case was in court trial until June 29, 2009, and I was sentenced to 150 years in prison. I am presently serving my jail term, and right now I am battling with Kidney Cancer and waiting for my death. The US government has confiscated all my assets, my wife has left me, and my two sons are dead. I have lost everything that is of value to in life, even my freedom, and my life is worthless and nothing matters to me again. Now i come to learn the lessons of life and i have thus accepted Jesus Christ as my lord and personal savior and I regret my past and thus very remorseful of my wrong doings, by betraying the people who entrusted me with fund. I am now a born again Christian and have repented from my sins. I still have in my possession a total sum of €100,000.000.00 (One Hundred Million Euro), which the USA Government is not aware of because the fund is hidden far away from American continent. I have determined to share this wealth and give back to people of the world , i want to give it to charity ,to the less privilege and provide homes to homeless, people who are facing hardship in life, Natural disaster and war victims of Middle East and Africa respectively. Motherless homes, old people's home etc I am writing you to assist me in distributing this fund, through charity means and give life to the less privileged ones. I have gone through your profiles during my search for someone that i could assign and commit this mission to and i am rightly convinced that somebody of your statue will not stoop so low to derail in this kind of social and humanitarian task for no reason whatsoever hence am contacting you. My instincts and fate has led me to you. You can read more details about me by typing my name in google.com (Bernard L Madoff). I will be waiting to hear from you any moment from now. May the peace of the lord be with you and your family. Regards Bernard Madoff ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: nvec: removes useless cast on a void pointer.
Patch to nvec.c to remove a useless cast on a void pointer. Signed-off-by: Ben Marsh --- drivers/staging/nvec/nvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index c335ae2..52d1363 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -141,7 +141,7 @@ static int nvec_status_notifier(struct notifier_block *nb, { struct nvec_chip *nvec = container_of(nb, struct nvec_chip, nvec_status_notifier); - unsigned char *msg = (unsigned char *)data; + unsigned char *msg = data; if (event_type != NVEC_CNTL) return NOTIFY_DONE; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: use completion instead of struct semaphore hif_sema_wait_response
This patch replaces struct semaphore hif_sema_wait_response with struct completion hif_wait_response. In case of struct hif_sema_wait_response, it better to use completion than semaphore. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0a922c7..e73ee89 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -232,7 +232,7 @@ static struct task_struct *hif_thread_handler; static struct message_queue hif_msg_q; static struct semaphore hif_sema_thread; static struct semaphore hif_sema_driver; -static struct semaphore hif_sema_wait_response; +static struct completion hif_wait_response; static struct semaphore hif_sema_deinit; static struct timer_list periodic_rssi; @@ -430,7 +430,7 @@ static s32 handle_get_mac_address(struct wilc_vif *vif, netdev_err(vif->ndev, "Failed to get mac address\n"); result = -EFAULT; } - up(&hif_sema_wait_response); + complete(&hif_wait_response); return result; } @@ -1938,7 +1938,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif, wilc_enable_tcp_ack_filter(false); if (pstrStatistics != &vif->wilc->dummy_statistics) - up(&hif_sema_wait_response); + complete(&hif_wait_response); return 0; } @@ -2172,7 +2172,7 @@ static void Handle_DelAllSta(struct wilc_vif *vif, ERRORHANDLER: kfree(wid.val); - up(&hif_sema_wait_response); + complete(&hif_wait_response); } static void Handle_DelStation(struct wilc_vif *vif, @@ -2485,7 +2485,7 @@ static void handle_get_tx_pwr(struct wilc_vif *vif, u8 *tx_pwr) if (ret) netdev_err(vif->ndev, "Failed to get TX PWR\n"); - up(&hif_sema_wait_response); + complete(&hif_wait_response); } static int hostIFthread(void *pvArg) @@ -3007,7 +3007,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr) return -EFAULT; } - down(&hif_sema_wait_response); + wait_for_completion(&hif_wait_response); return result; } @@ -3272,7 +3272,7 @@ int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats) } if (stats != &vif->wilc->dummy_statistics) - down(&hif_sema_wait_response); + wait_for_completion(&hif_wait_response); return result; } @@ -3382,7 +3382,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) scan_while_connected = false; - sema_init(&hif_sema_wait_response, 0); + init_completion(&hif_wait_response); hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL); if (!hif_drv) { @@ -3888,7 +3888,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]) if (result) netdev_err(vif->ndev, "wilc_mq_send fail\n"); - down(&hif_sema_wait_response); + wait_for_completion(&hif_wait_response); return result; } @@ -4221,7 +4221,7 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power) if (ret) netdev_err(vif->ndev, "Failed to get TX PWR\n"); - down(&hif_sema_wait_response); + wait_for_completion(&hif_wait_response); *tx_power = msg.body.tx_power.tx_pwr; return ret; -- 2.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] android: lmk: add swap pte pmd in tasksize
Hi greg, On 2016/3/12 1:12, Greg KH wrote: > On Fri, Mar 11, 2016 at 05:05:45PM +0800, Chen Feng wrote: >> >> >> On 2016/3/11 15:30, yalin wang wrote: >>> On Mar 11, 2016, at 15:23, Lu Bing wrote: From: l00215322 Many android devices have zram,so we should add "MM_SWAPENTS" in tasksize. Refer oom_kill.c,we add pte&pmd also. Reviewed-by: Chen Feng Reviewed-by: Fu Jun Reviewed-by: Xu YiPing Reviewed-by: Yu DongBin Signed-off-by: Lu Bing --- drivers/staging/android/lowmemorykiller.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 8b5a4a8..0817d3b 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -139,7 +139,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) task_unlock(p); continue; } - tasksize = get_mm_rss(p->mm); + tasksize = get_mm_rss(p->mm) + + get_mm_counter(p->mm, MM_SWAPENTS) + + atomic_long_read(&p->mm->nr_ptes) + mm_nr_pmds(p->mm); >>> why not introduce a mm_nr_ptes() help function here ? >>> more clear to see . >>> >> Since the code is in staging, we can add another patch to do this. > > I do not understand this, please explain. > I mean that we can submit another patch to add mm_nr_ptes() in mm-module and replace the code used nr_ptes with this interface(mm_nr_ptes()). This patch is just change the score of task-size in low memory killer. > thanks, > > greg k-h > > . > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Add tw5864 driver - cover letter
From: Andrey Utkin This is a driver for multimedia devices based on Techwell/Intersil TW5864 chip. It is basically written from scratch. There was an awful reference driver for 2.6 kernel, which is nearly million lines of code and requires half a dozen special userspace libraries, and still doesn't quite work. So currently submitted driver is a product of reverse-engineering and heuristics. tw68 driver was used as code skeleton. The device advertises many capabilities, but this version of driver only supports H.264 encoding of captured video channels. There is one known issue, which reproduces on two of five setups of which I know: P-frames are distorted, but I-frames are fine. Changing quality and framerate settings does not affect this. Currently such workaround is used: v4l2-ctl -d /dev/video$n -c video_gop_size=1 GOP size is set to 1, so that every output frame is I-frame. We are regularly contacting manufacturer regarding such issues, but unfortunately they can do little to help us. Andrey Utkin (1): Add tw5864 driver MAINTAINERS |7 + drivers/staging/media/Kconfig|2 + drivers/staging/media/Makefile |1 + drivers/staging/media/tw5864/Kconfig | 11 + drivers/staging/media/tw5864/Makefile|3 + drivers/staging/media/tw5864/tw5864-bs.h | 154 ++ drivers/staging/media/tw5864/tw5864-config.c | 359 + drivers/staging/media/tw5864/tw5864-core.c | 453 ++ drivers/staging/media/tw5864/tw5864-h264.c | 183 +++ drivers/staging/media/tw5864/tw5864-reg.h| 2200 ++ drivers/staging/media/tw5864/tw5864-tables.h | 237 +++ drivers/staging/media/tw5864/tw5864-video.c | 1364 drivers/staging/media/tw5864/tw5864.h| 280 include/linux/pci_ids.h |1 + 14 files changed, 5255 insertions(+) create mode 100644 drivers/staging/media/tw5864/Kconfig create mode 100644 drivers/staging/media/tw5864/Makefile create mode 100644 drivers/staging/media/tw5864/tw5864-bs.h create mode 100644 drivers/staging/media/tw5864/tw5864-config.c create mode 100644 drivers/staging/media/tw5864/tw5864-core.c create mode 100644 drivers/staging/media/tw5864/tw5864-h264.c create mode 100644 drivers/staging/media/tw5864/tw5864-reg.h create mode 100644 drivers/staging/media/tw5864/tw5864-tables.h create mode 100644 drivers/staging/media/tw5864/tw5864-video.c create mode 100644 drivers/staging/media/tw5864/tw5864.h -- 2.7.1.380.g0fea050.dirty ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Add tw5864 driver - cover letter
This is a driver for multimedia devices based on Techwell/Intersil TW5864 chip. It is basically written from scratch. There was an awful reference driver for 2.6 kernel, which is nearly million lines of code and requires half a dozen special userspace libraries, and still doesn't quite work. So currently submitted driver is a product of reverse-engineering and heuristics. tw68 driver was used as code skeleton. The device advertises many capabilities, but this version of driver only supports H.264 encoding of captured video channels. There is one known issue, which reproduces on two of five setups of which I know: P-frames are distorted, but I-frames are fine. Changing quality and framerate settings does not affect this. Currently such workaround is used: v4l2-ctl -d /dev/video$n -c video_gop_size=1 GOP size is set to 1, so that every output frame is I-frame. We are regularly contacting manufacturer regarding such issues, but unfortunately they can do little to help us. Andrey Utkin (1): Add tw5864 driver MAINTAINERS |7 + drivers/staging/media/Kconfig|2 + drivers/staging/media/Makefile |1 + drivers/staging/media/tw5864/Kconfig | 11 + drivers/staging/media/tw5864/Makefile|3 + drivers/staging/media/tw5864/tw5864-bs.h | 154 ++ drivers/staging/media/tw5864/tw5864-config.c | 359 + drivers/staging/media/tw5864/tw5864-core.c | 453 ++ drivers/staging/media/tw5864/tw5864-h264.c | 183 +++ drivers/staging/media/tw5864/tw5864-reg.h| 2200 ++ drivers/staging/media/tw5864/tw5864-tables.h | 237 +++ drivers/staging/media/tw5864/tw5864-video.c | 1364 drivers/staging/media/tw5864/tw5864.h| 280 include/linux/pci_ids.h |1 + 14 files changed, 5255 insertions(+) create mode 100644 drivers/staging/media/tw5864/Kconfig create mode 100644 drivers/staging/media/tw5864/Makefile create mode 100644 drivers/staging/media/tw5864/tw5864-bs.h create mode 100644 drivers/staging/media/tw5864/tw5864-config.c create mode 100644 drivers/staging/media/tw5864/tw5864-core.c create mode 100644 drivers/staging/media/tw5864/tw5864-h264.c create mode 100644 drivers/staging/media/tw5864/tw5864-reg.h create mode 100644 drivers/staging/media/tw5864/tw5864-tables.h create mode 100644 drivers/staging/media/tw5864/tw5864-video.c create mode 100644 drivers/staging/media/tw5864/tw5864.h -- 2.7.1.380.g0fea050.dirty ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Add tw5864 driver
On Mon, Mar 14, 2016 at 03:55:14AM +0200, Andrey Utkin wrote: > --- a/include/linux/pci_ids.h > +++ b/include/linux/pci_ids.h > @@ -2333,6 +2333,7 @@ > #define PCI_VENDOR_ID_CAVIUM 0x177d > > #define PCI_VENDOR_ID_TECHWELL 0x1797 > +#define PCI_DEVICE_ID_TECHWELL_5864 0x5864 > #define PCI_DEVICE_ID_TECHWELL_6800 0x6800 > #define PCI_DEVICE_ID_TECHWELL_6801 0x6801 > #define PCI_DEVICE_ID_TECHWELL_6804 0x6804 Please read the comments at the top of this file for why you don't need to put any new ids into it. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/9] staging: rtl8192u: check return value eprom_read
The call of eprom_read may fail, therefore its return value must be checked. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U_core.c | 147 +++-- 1 file changed, 104 insertions(+), 43 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 3a93218..1c09c61 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2432,6 +2432,7 @@ static inline u16 endian_swap(u16 *data) *data = (tmp >> 8) | (tmp << 8); return *data; } + static void rtl8192_read_eeprom_info(struct net_device *dev) { u16 wEPROM_ID = 0; @@ -2440,9 +2441,13 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); u16 tmpValue = 0; int i; + int ret; RT_TRACE(COMP_EPROM, "===>%s()\n", __func__); - wEPROM_ID = eprom_read(dev, 0); /* first read EEPROM ID out; */ + ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ + if (ret) + return; + wEPROM_ID = (u16)ret; RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); if (wEPROM_ID != RTL8190_EEPROM_ID) @@ -2453,14 +2458,25 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) bLoad_From_EEPOM = true; if (bLoad_From_EEPOM) { - tmpValue = eprom_read(dev, EEPROM_VID >> 1); + ret = eprom_read(dev, EEPROM_VID >> 1); + if (ret) + return; + tmpValue = (u16)ret; priv->eeprom_vid = endian_swap(&tmpValue); - priv->eeprom_pid = eprom_read(dev, EEPROM_PID >> 1); - tmpValue = eprom_read(dev, EEPROM_ChannelPlan >> 1); + ret = eprom_read(dev, EEPROM_PID >> 1); + if (ret) + return; + priv->eeprom_pid = (u16)ret; + ret = eprom_read(dev, EEPROM_ChannelPlan >> 1); + if (ret) + return; + tmpValue = (u16)ret; priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8; priv->btxpowerdata_readfromEEPORM = true; - priv->eeprom_CustomerID = - eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; + ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; + if (ret) + return; + priv->eeprom_CustomerID = (u16)ret; } else { priv->eeprom_vid = 0; priv->eeprom_pid = 0; @@ -2478,10 +2494,11 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) int i; for (i = 0; i < 6; i += 2) { - u16 tmp = 0; - - tmp = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); - *(u16 *)(&dev->dev_addr[i]) = tmp; + ret = eprom_read(dev, +(u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); + if (ret) + return; + *(u16 *)(&dev->dev_addr[i]) = (u16)ret; } } else { memcpy(dev->dev_addr, bMac_Tmp_Addr, 6); @@ -2493,48 +2510,77 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (priv->card_8192_version == (u8)VERSION_819xU_A) { /* read Tx power gain offset of legacy OFDM to HT rate */ - if (bLoad_From_EEPOM) - priv->EEPROMTxPowerDiff = (eprom_read(dev, (EEPROM_TxPowerDiff >> 1)) & 0xff00) >> 8; - else + if (bLoad_From_EEPOM) { + ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1)); + if (ret) + return; + priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8; + } else { priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; + } RT_TRACE(COMP_EPROM, "TxPowerDiff:%d\n", priv->EEPROMTxPowerDiff); /* read ThermalMeter from EEPROM */ - if (bLoad_From_EEPOM) - priv->EEPROMThermalMeter = (u8)(eprom_read(dev, (EEPROM_ThermalMeter >> 1)) & 0x00ff); - else + if (bLoad_From_EEPOM) { + ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1)); + if (ret) + return; + priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff); + } else { priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; + } RT_TRACE(COMP_EPROM, "ThermalMeter:%d\n", priv->EEPROMThermalMeter); /* for tx power track */ priv->TSSI_13dB
[PATCH 0/9] staging: rtl8192u: Checking return value/propagating errors
These patchs check the return value/propagate error of the functions read_nic_word_E,eprom_r, eprom_read, rtl8192_read_eeprom_info, write_nic_*. Salah Triki (9): staging: rtl8192u: check return value of read_nic_word_E staging: rtl8192u: eprom_read: check return value of eprom_r staging: rtl8192u: check return value eprom_read staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info staging: rtl8192u: check return value of rtl8192_read_eeprom_info staging: rtl8192u: propagate errors in write_nic_byte staging: rtl8192u: propagate errors in write_nic_byte_E staging: rtl8192u: propagate errors in write_nic_word staging: rtl8192u: propagate errors in write_nic_dword drivers/staging/rtl8192u/r8180_93cx6.c | 31 -- drivers/staging/rtl8192u/r8180_93cx6.h | 2 +- drivers/staging/rtl8192u/r8192U.h | 8 +- drivers/staging/rtl8192u/r8192U_core.c | 194 +++-- 4 files changed, 164 insertions(+), 71 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/9] staging: rtl8192u: check return value of read_nic_word_E
The call of read_nic_word_E may fail, therefore its return value must be checked and propagated in the case of error. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8180_93cx6.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index 97d9b3f..da68b67 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -23,8 +23,11 @@ static void eprom_cs(struct net_device *dev, short bit) { u8 cmdreg; + int err; - read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + if (err) + return; if (bit) /* enable EPROM */ write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CS_BIT); @@ -40,8 +43,11 @@ static void eprom_cs(struct net_device *dev, short bit) static void eprom_ck_cycle(struct net_device *dev) { u8 cmdreg; + int err; - read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + if (err) + return; write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CK_BIT); force_pci_posting(dev); udelay(EPROM_DELAY); @@ -56,8 +62,11 @@ static void eprom_ck_cycle(struct net_device *dev) static void eprom_w(struct net_device *dev, short bit) { u8 cmdreg; + int err; - read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + if (err) + return; if (bit) write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_W_BIT); else @@ -71,8 +80,12 @@ static void eprom_w(struct net_device *dev, short bit) static short eprom_r(struct net_device *dev) { u8 bit; + int err; + + err = read_nic_byte_E(dev, EPROM_CMD, &bit); + if (err) + return err; - read_nic_byte_E(dev, EPROM_CMD, &bit); udelay(EPROM_DELAY); if (bit & EPROM_R_BIT) @@ -102,7 +115,6 @@ u32 eprom_read(struct net_device *dev, u32 addr) int addr_len; u32 ret; - ret = 0; /* enable EPROM programming */ write_nic_byte_E(dev, EPROM_CMD, (EPROM_CMD_PROGRAM
[PATCH 2/9] staging: rtl8192u: eprom_read: check return value of eprom_r
Check the return value from eprom_r and propagate it in the case of error. The error code is a negative value, therefore change the return type of eprom_read from u32 to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8180_93cx6.c | 9 +++-- drivers/staging/rtl8192u/r8180_93cx6.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index da68b67..9ee30a0 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -106,7 +106,7 @@ static void eprom_send_bits_string(struct net_device *dev, short b[], int len) } -u32 eprom_read(struct net_device *dev, u32 addr) +int eprom_read(struct net_device *dev, u32 addr) { struct r8192_priv *priv = ieee80211_priv(dev); short read_cmd[] = {1, 1, 0}; @@ -114,6 +114,7 @@ u32 eprom_read(struct net_device *dev, u32 addr) int i; int addr_len; u32 ret; + int err; /* enable EPROM programming */ write_nic_byte_E(dev, EPROM_CMD, @@ -156,7 +157,11 @@ u32 eprom_read(struct net_device *dev, u32 addr) * and reading data. (eeprom outs a dummy 0) */ eprom_ck_cycle(dev); - ret |= (eprom_r(dev) << (15 - i)); + err = eprom_r(dev); + if (err) + return err; + + ret |= err<<(15-i); } eprom_cs(dev, 0); diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h b/drivers/staging/rtl8192u/r8180_93cx6.h index b840348..9cf7f58 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.h +++ b/drivers/staging/rtl8192u/r8180_93cx6.h @@ -40,4 +40,4 @@ #define EPROM_TXPW1 0x3d -u32 eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */ +int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/9] staging: rtl8192u: check return value of rtl8192_read_eeprom_info
The call of rtl8192_read_eeprom_info may fail, therefore its return value must be checked and propagated in the case of error. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U_core.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e7168da..1535980 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2743,6 +2743,7 @@ static short rtl8192_init(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); memset(&(priv->stats), 0, sizeof(struct Stats)); memset(priv->txqueue_to_outpipemap, 0, 9); + int err; #ifdef PIPE12 { int i = 0; @@ -2761,7 +2762,9 @@ static short rtl8192_init(struct net_device *dev) rtl8192_init_priv_lock(priv); rtl8192_init_priv_task(dev); rtl8192_get_eeprom_size(dev); - rtl8192_read_eeprom_info(dev); + err = rtl8192_read_eeprom_info(dev); + if (err) + return err; rtl8192_get_channel_map(dev); init_hal_dm(dev); setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/9] staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info
Propagate error from eprom_read and change the return type of rtl8192_read_eeprom_info from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U_core.c | 37 +- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 1c09c61..e7168da 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2433,7 +2433,7 @@ static inline u16 endian_swap(u16 *data) return *data; } -static void rtl8192_read_eeprom_info(struct net_device *dev) +static int rtl8192_read_eeprom_info(struct net_device *dev) { u16 wEPROM_ID = 0; u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x02}; @@ -2446,7 +2446,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) RT_TRACE(COMP_EPROM, "===>%s()\n", __func__); ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ if (ret) - return; + return ret; wEPROM_ID = (u16)ret; RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); @@ -2460,22 +2460,22 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, EEPROM_VID >> 1); if (ret) - return; + return ret; tmpValue = (u16)ret; priv->eeprom_vid = endian_swap(&tmpValue); ret = eprom_read(dev, EEPROM_PID >> 1); if (ret) - return; + return ret; priv->eeprom_pid = (u16)ret; ret = eprom_read(dev, EEPROM_ChannelPlan >> 1); if (ret) - return; + return ret; tmpValue = (u16)ret; priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8; priv->btxpowerdata_readfromEEPORM = true; ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; if (ret) - return; + return ret; priv->eeprom_CustomerID = (u16)ret; } else { priv->eeprom_vid = 0; @@ -2497,7 +2497,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ret = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); if (ret) - return; + return ret; *(u16 *)(&dev->dev_addr[i]) = (u16)ret; } } else { @@ -2513,7 +2513,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1)); if (ret) - return; + return ret; priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8; } else { priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; @@ -2523,7 +2523,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1)); if (ret) - return; + return ret; priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff); } else { priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; @@ -2535,7 +2535,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_PwDiff >> 1)); if (ret) - return; + return ret; priv->EEPROMPwDiff = ((u16)ret & 0x0f00) >> 8; } else { priv->EEPROMPwDiff = EEPROM_Default_PwDiff; @@ -2545,7 +2545,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_CrystalCap >> 1)); if (ret) - return; + return ret; priv->EEPROMCrystalCap = ((u16)ret & 0x0f); } else { priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap; @@ -2555,7 +2555,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1)); if (ret) - return; +
[PATCH 7/9] staging: rtl8192u: propagate errors in write_nic_byte_E
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte_E from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 9 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index da9b92b..e0abcf5 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1130,7 +1130,7 @@ int read_nic_byte_E(struct net_device *dev, int x, u8 *data); int read_nic_dword(struct net_device *dev, int x, u32 *data); int read_nic_word(struct net_device *dev, int x, u16 *data); int write_nic_byte(struct net_device *dev, int x, u8 y); -void write_nic_byte_E(struct net_device *dev, int x, u8 y); +int write_nic_byte_E(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 556a093..3d5812b 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -254,7 +254,7 @@ u32 read_cam(struct net_device *dev, u8 addr) return data; } -void write_nic_byte_E(struct net_device *dev, int indx, u8 data) +int write_nic_byte_E(struct net_device *dev, int indx, u8 data) { int status; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); @@ -262,7 +262,7 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -270,9 +270,12 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) indx | 0xfe00, 0, usbdata, 1, HZ / 2); kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", status); + return status; + } + return 0; } int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/9] staging: rtl8192u: propagate errors in write_nic_word
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_word from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 9 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index e0abcf5..27f9aa5 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1131,7 +1131,7 @@ int read_nic_dword(struct net_device *dev, int x, u32 *data); int read_nic_word(struct net_device *dev, int x, u16 *data); int write_nic_byte(struct net_device *dev, int x, u8 y); int write_nic_byte_E(struct net_device *dev, int x, u8 y); -void write_nic_word(struct net_device *dev, int x, u16 y); +int write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 3d5812b..5266fc3 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -329,7 +329,7 @@ int write_nic_byte(struct net_device *dev, int indx, u8 data) } -void write_nic_word(struct net_device *dev, int indx, u16 data) +int write_nic_word(struct net_device *dev, int indx, u16 data) { int status; @@ -339,7 +339,7 @@ void write_nic_word(struct net_device *dev, int indx, u16 data) u16 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -348,9 +348,12 @@ void write_nic_word(struct net_device *dev, int indx, u16 data) usbdata, 2, HZ / 2); kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_word TimeOut! status: %d\n", status); + return status; + } + return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 9/9] staging: rtl8192u: propagate errors in write_nic_dword
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_dword from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 9 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 27f9aa5..eb0c351 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1132,7 +1132,7 @@ int read_nic_word(struct net_device *dev, int x, u16 *data); int write_nic_byte(struct net_device *dev, int x, u8 y); int write_nic_byte_E(struct net_device *dev, int x, u8 y); int write_nic_word(struct net_device *dev, int x, u16 y); -void write_nic_dword(struct net_device *dev, int x, u32 y); +int write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); void rtl8192_rtx_disable(struct net_device *); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 5266fc3..f2518c8 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -357,7 +357,7 @@ int write_nic_word(struct net_device *dev, int indx, u16 data) } -void write_nic_dword(struct net_device *dev, int indx, u32 data) +int write_nic_dword(struct net_device *dev, int indx, u32 data) { int status; @@ -367,7 +367,7 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) u32 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -377,10 +377,13 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_dword TimeOut! status: %d\n", status); + return status; + } + return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/9] staging: rtl8192u: propagate errors in write_nic_byte
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 12 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index ee1c722..da9b92b 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1129,7 +1129,7 @@ int read_nic_byte(struct net_device *dev, int x, u8 *data); int read_nic_byte_E(struct net_device *dev, int x, u8 *data); int read_nic_dword(struct net_device *dev, int x, u32 *data); int read_nic_word(struct net_device *dev, int x, u16 *data); -void write_nic_byte(struct net_device *dev, int x, u8 y); +int write_nic_byte(struct net_device *dev, int x, u8 y); void write_nic_byte_E(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 1535980..556a093 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -299,7 +299,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) return 0; } /* as 92U has extend page from 4 to 16, so modify functions below. */ -void write_nic_byte(struct net_device *dev, int indx, u8 data) +int write_nic_byte(struct net_device *dev, int indx, u8 data) { int status; @@ -308,7 +308,7 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data) u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -317,10 +317,12 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data) usbdata, 1, HZ / 2); kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_byte TimeOut! status: %d\n", status); - - + return status; + } + + return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Add tw5864 driver
On Mon, Mar 14, 2016 at 03:55:14AM +0200, Andrey Utkin wrote: > From: Andrey Utkin > > Support for boards based on Techwell TW5864 chip which provides > multichannel video & audio grabbing and encoding (H.264, MJPEG, > ADPCM G.726). > > Signed-off-by: Andrey Utkin > Tested-by: Andrey Utkin Meta-conmment, why add this to drivers/staging/media? Why can't it just go into drivers/media/ ? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/9] staging: rtl8192u: check return value of rtl8192_read_eeprom_info
Hi Salah, [auto build test WARNING on staging/staging-testing] [also build test WARNING on v4.5-rc7 next-20160311] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Salah-Triki/staging-rtl8192u-Checking-return-value-propagating-errors/20160314-111200 config: xtensa-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=xtensa All warnings (new ones prefixed by >>): drivers/staging/rtl8192u/r8192U_core.c: In function 'rtl8192_init': >> drivers/staging/rtl8192u/r8192U_core.c:2746:2: warning: ISO C90 forbids >> mixed declarations and code [-Wdeclaration-after-statement] int err; ^ vim +2746 drivers/staging/rtl8192u/r8192U_core.c 2730 netdev_err(dev, 2731 "rtl8180_init: Error channel plan! Set to default.\n"); 2732 priv->ChannelPlan = 0; 2733 } 2734 RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); 2735 2736 rtl819x_set_channel_map(priv->ChannelPlan, priv); 2737 return 0; 2738 } 2739 2740 static short rtl8192_init(struct net_device *dev) 2741 { 2742 2743 struct r8192_priv *priv = ieee80211_priv(dev); 2744 memset(&(priv->stats), 0, sizeof(struct Stats)); 2745 memset(priv->txqueue_to_outpipemap, 0, 9); > 2746 int err; 2747 #ifdef PIPE12 2748 { 2749 int i = 0; 2750 u8 queuetopipe[] = {3, 2, 1, 0, 4, 8, 7, 6, 5}; 2751 2752 memcpy(priv->txqueue_to_outpipemap, queuetopipe, 9); 2753 } 2754 #else --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 1/9] staging: rtl8192u: check return value of read_nic_word_E
The call of read_nic_word_E may fail, therefore its return value must be checked and propagated in the case of error. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8180_93cx6.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index 97d9b3f..da68b67 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -23,8 +23,11 @@ static void eprom_cs(struct net_device *dev, short bit) { u8 cmdreg; + int err; - read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + if (err) + return; if (bit) /* enable EPROM */ write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CS_BIT); @@ -40,8 +43,11 @@ static void eprom_cs(struct net_device *dev, short bit) static void eprom_ck_cycle(struct net_device *dev) { u8 cmdreg; + int err; - read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + if (err) + return; write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CK_BIT); force_pci_posting(dev); udelay(EPROM_DELAY); @@ -56,8 +62,11 @@ static void eprom_ck_cycle(struct net_device *dev) static void eprom_w(struct net_device *dev, short bit) { u8 cmdreg; + int err; - read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg); + if (err) + return; if (bit) write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_W_BIT); else @@ -71,8 +80,12 @@ static void eprom_w(struct net_device *dev, short bit) static short eprom_r(struct net_device *dev) { u8 bit; + int err; + + err = read_nic_byte_E(dev, EPROM_CMD, &bit); + if (err) + return err; - read_nic_byte_E(dev, EPROM_CMD, &bit); udelay(EPROM_DELAY); if (bit & EPROM_R_BIT) @@ -102,7 +115,6 @@ u32 eprom_read(struct net_device *dev, u32 addr) int addr_len; u32 ret; - ret = 0; /* enable EPROM programming */ write_nic_byte_E(dev, EPROM_CMD, (EPROM_CMD_PROGRAM
[PATCH V2 3/9] staging: rtl8192u: check return value eprom_read
The call of eprom_read may fail, therefore its return value must be checked. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U_core.c | 147 +++-- 1 file changed, 104 insertions(+), 43 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 3a93218..1c09c61 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2432,6 +2432,7 @@ static inline u16 endian_swap(u16 *data) *data = (tmp >> 8) | (tmp << 8); return *data; } + static void rtl8192_read_eeprom_info(struct net_device *dev) { u16 wEPROM_ID = 0; @@ -2440,9 +2441,13 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); u16 tmpValue = 0; int i; + int ret; RT_TRACE(COMP_EPROM, "===>%s()\n", __func__); - wEPROM_ID = eprom_read(dev, 0); /* first read EEPROM ID out; */ + ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ + if (ret) + return; + wEPROM_ID = (u16)ret; RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); if (wEPROM_ID != RTL8190_EEPROM_ID) @@ -2453,14 +2458,25 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) bLoad_From_EEPOM = true; if (bLoad_From_EEPOM) { - tmpValue = eprom_read(dev, EEPROM_VID >> 1); + ret = eprom_read(dev, EEPROM_VID >> 1); + if (ret) + return; + tmpValue = (u16)ret; priv->eeprom_vid = endian_swap(&tmpValue); - priv->eeprom_pid = eprom_read(dev, EEPROM_PID >> 1); - tmpValue = eprom_read(dev, EEPROM_ChannelPlan >> 1); + ret = eprom_read(dev, EEPROM_PID >> 1); + if (ret) + return; + priv->eeprom_pid = (u16)ret; + ret = eprom_read(dev, EEPROM_ChannelPlan >> 1); + if (ret) + return; + tmpValue = (u16)ret; priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8; priv->btxpowerdata_readfromEEPORM = true; - priv->eeprom_CustomerID = - eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; + ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; + if (ret) + return; + priv->eeprom_CustomerID = (u16)ret; } else { priv->eeprom_vid = 0; priv->eeprom_pid = 0; @@ -2478,10 +2494,11 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) int i; for (i = 0; i < 6; i += 2) { - u16 tmp = 0; - - tmp = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); - *(u16 *)(&dev->dev_addr[i]) = tmp; + ret = eprom_read(dev, +(u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); + if (ret) + return; + *(u16 *)(&dev->dev_addr[i]) = (u16)ret; } } else { memcpy(dev->dev_addr, bMac_Tmp_Addr, 6); @@ -2493,48 +2510,77 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (priv->card_8192_version == (u8)VERSION_819xU_A) { /* read Tx power gain offset of legacy OFDM to HT rate */ - if (bLoad_From_EEPOM) - priv->EEPROMTxPowerDiff = (eprom_read(dev, (EEPROM_TxPowerDiff >> 1)) & 0xff00) >> 8; - else + if (bLoad_From_EEPOM) { + ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1)); + if (ret) + return; + priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8; + } else { priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; + } RT_TRACE(COMP_EPROM, "TxPowerDiff:%d\n", priv->EEPROMTxPowerDiff); /* read ThermalMeter from EEPROM */ - if (bLoad_From_EEPOM) - priv->EEPROMThermalMeter = (u8)(eprom_read(dev, (EEPROM_ThermalMeter >> 1)) & 0x00ff); - else + if (bLoad_From_EEPOM) { + ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1)); + if (ret) + return; + priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff); + } else { priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; + } RT_TRACE(COMP_EPROM, "ThermalMeter:%d\n", priv->EEPROMThermalMeter); /* for tx power track */ priv->TSSI_13dB
[PATCH V2 2/9] staging: rtl8192u: eprom_read: check return value of eprom_r
Check the return value from eprom_r and propagate it in the case of error. The error code is a negative value, therefore change the return type of eprom_read from u32 to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8180_93cx6.c | 9 +++-- drivers/staging/rtl8192u/r8180_93cx6.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index da68b67..9ee30a0 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -106,7 +106,7 @@ static void eprom_send_bits_string(struct net_device *dev, short b[], int len) } -u32 eprom_read(struct net_device *dev, u32 addr) +int eprom_read(struct net_device *dev, u32 addr) { struct r8192_priv *priv = ieee80211_priv(dev); short read_cmd[] = {1, 1, 0}; @@ -114,6 +114,7 @@ u32 eprom_read(struct net_device *dev, u32 addr) int i; int addr_len; u32 ret; + int err; /* enable EPROM programming */ write_nic_byte_E(dev, EPROM_CMD, @@ -156,7 +157,11 @@ u32 eprom_read(struct net_device *dev, u32 addr) * and reading data. (eeprom outs a dummy 0) */ eprom_ck_cycle(dev); - ret |= (eprom_r(dev) << (15 - i)); + err = eprom_r(dev); + if (err) + return err; + + ret |= err<<(15-i); } eprom_cs(dev, 0); diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h b/drivers/staging/rtl8192u/r8180_93cx6.h index b840348..9cf7f58 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.h +++ b/drivers/staging/rtl8192u/r8180_93cx6.h @@ -40,4 +40,4 @@ #define EPROM_TXPW1 0x3d -u32 eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */ +int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 0/9] staging: rtl8192u: Checking return value/propagating errors
These patchs check the return value/propagate error of the functions read_nic_word_E,eprom_r, eprom_read, rtl8192_read_eeprom_info, write_nic_*. Salah Triki (9): staging: rtl8192u: check return value of read_nic_word_E staging: rtl8192u: eprom_read: check return value of eprom_r staging: rtl8192u: check return value eprom_read staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info staging: rtl8192u: check return value of rtl8192_read_eeprom_info staging: rtl8192u: propagate errors in write_nic_byte staging: rtl8192u: propagate errors in write_nic_byte_E staging: rtl8192u: propagate errors in write_nic_word staging: rtl8192u: propagate errors in write_nic_dword drivers/staging/rtl8192u/r8180_93cx6.c | 31 -- drivers/staging/rtl8192u/r8180_93cx6.h | 2 +- drivers/staging/rtl8192u/r8192U.h | 8 +- drivers/staging/rtl8192u/r8192U_core.c | 193 +++-- 4 files changed, 164 insertions(+), 70 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 6/9] staging: rtl8192u: propagate errors in write_nic_byte
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 12 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index ee1c722..da9b92b 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1129,7 +1129,7 @@ int read_nic_byte(struct net_device *dev, int x, u8 *data); int read_nic_byte_E(struct net_device *dev, int x, u8 *data); int read_nic_dword(struct net_device *dev, int x, u32 *data); int read_nic_word(struct net_device *dev, int x, u16 *data); -void write_nic_byte(struct net_device *dev, int x, u8 y); +int write_nic_byte(struct net_device *dev, int x, u8 y); void write_nic_byte_E(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 1f23a65..678f4e7 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -299,7 +299,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) return 0; } /* as 92U has extend page from 4 to 16, so modify functions below. */ -void write_nic_byte(struct net_device *dev, int indx, u8 data) +int write_nic_byte(struct net_device *dev, int indx, u8 data) { int status; @@ -308,7 +308,7 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data) u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -317,10 +317,12 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data) usbdata, 1, HZ / 2); kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_byte TimeOut! status: %d\n", status); - - + return status; + } + + return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 5/9] staging: rtl8192u: check return value of rtl8192_read_eeprom_info
The call of rtl8192_read_eeprom_info may fail, therefore its return value must be checked and propagated in the case of error. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U_core.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e7168da..1f23a65 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2741,6 +2741,8 @@ static short rtl8192_init(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); + int err; + memset(&(priv->stats), 0, sizeof(struct Stats)); memset(priv->txqueue_to_outpipemap, 0, 9); #ifdef PIPE12 @@ -2761,7 +2763,9 @@ static short rtl8192_init(struct net_device *dev) rtl8192_init_priv_lock(priv); rtl8192_init_priv_task(dev); rtl8192_get_eeprom_size(dev); - rtl8192_read_eeprom_info(dev); + err = rtl8192_read_eeprom_info(dev); + if (err) + return err; rtl8192_get_channel_map(dev); init_hal_dm(dev); setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 7/9] staging: rtl8192u: propagate errors in write_nic_byte_E
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte_E from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 9 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index da9b92b..e0abcf5 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1130,7 +1130,7 @@ int read_nic_byte_E(struct net_device *dev, int x, u8 *data); int read_nic_dword(struct net_device *dev, int x, u32 *data); int read_nic_word(struct net_device *dev, int x, u16 *data); int write_nic_byte(struct net_device *dev, int x, u8 y); -void write_nic_byte_E(struct net_device *dev, int x, u8 y); +int write_nic_byte_E(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 678f4e7..4c6d444 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -254,7 +254,7 @@ u32 read_cam(struct net_device *dev, u8 addr) return data; } -void write_nic_byte_E(struct net_device *dev, int indx, u8 data) +int write_nic_byte_E(struct net_device *dev, int indx, u8 data) { int status; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); @@ -262,7 +262,7 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -270,9 +270,12 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) indx | 0xfe00, 0, usbdata, 1, HZ / 2); kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", status); + return status; + } + return 0; } int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 4/9] staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info
Propagate error from eprom_read and change the return type of rtl8192_read_eeprom_info from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U_core.c | 37 +- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 1c09c61..e7168da 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2433,7 +2433,7 @@ static inline u16 endian_swap(u16 *data) return *data; } -static void rtl8192_read_eeprom_info(struct net_device *dev) +static int rtl8192_read_eeprom_info(struct net_device *dev) { u16 wEPROM_ID = 0; u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x02}; @@ -2446,7 +2446,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) RT_TRACE(COMP_EPROM, "===>%s()\n", __func__); ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ if (ret) - return; + return ret; wEPROM_ID = (u16)ret; RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); @@ -2460,22 +2460,22 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, EEPROM_VID >> 1); if (ret) - return; + return ret; tmpValue = (u16)ret; priv->eeprom_vid = endian_swap(&tmpValue); ret = eprom_read(dev, EEPROM_PID >> 1); if (ret) - return; + return ret; priv->eeprom_pid = (u16)ret; ret = eprom_read(dev, EEPROM_ChannelPlan >> 1); if (ret) - return; + return ret; tmpValue = (u16)ret; priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8; priv->btxpowerdata_readfromEEPORM = true; ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; if (ret) - return; + return ret; priv->eeprom_CustomerID = (u16)ret; } else { priv->eeprom_vid = 0; @@ -2497,7 +2497,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) ret = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); if (ret) - return; + return ret; *(u16 *)(&dev->dev_addr[i]) = (u16)ret; } } else { @@ -2513,7 +2513,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1)); if (ret) - return; + return ret; priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8; } else { priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; @@ -2523,7 +2523,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1)); if (ret) - return; + return ret; priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff); } else { priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; @@ -2535,7 +2535,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_PwDiff >> 1)); if (ret) - return; + return ret; priv->EEPROMPwDiff = ((u16)ret & 0x0f00) >> 8; } else { priv->EEPROMPwDiff = EEPROM_Default_PwDiff; @@ -2545,7 +2545,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_CrystalCap >> 1)); if (ret) - return; + return ret; priv->EEPROMCrystalCap = ((u16)ret & 0x0f); } else { priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap; @@ -2555,7 +2555,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (bLoad_From_EEPOM) { ret = eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1)); if (ret) - return; +
[PATCH V2 9/9] staging: rtl8192u: propagate errors in write_nic_dword
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_dword from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 9 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 27f9aa5..eb0c351 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1132,7 +1132,7 @@ int read_nic_word(struct net_device *dev, int x, u16 *data); int write_nic_byte(struct net_device *dev, int x, u8 y); int write_nic_byte_E(struct net_device *dev, int x, u8 y); int write_nic_word(struct net_device *dev, int x, u16 y); -void write_nic_dword(struct net_device *dev, int x, u32 y); +int write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); void rtl8192_rtx_disable(struct net_device *); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 9303715..695faed 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -357,7 +357,7 @@ int write_nic_word(struct net_device *dev, int indx, u16 data) } -void write_nic_dword(struct net_device *dev, int indx, u32 data) +int write_nic_dword(struct net_device *dev, int indx, u32 data) { int status; @@ -367,7 +367,7 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) u32 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -377,10 +377,13 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_dword TimeOut! status: %d\n", status); + return status; + } + return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 8/9] staging: rtl8192u: propagate errors in write_nic_word
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_word from void to int. Signed-off-by: Salah Triki --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 9 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index e0abcf5..27f9aa5 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1131,7 +1131,7 @@ int read_nic_dword(struct net_device *dev, int x, u32 *data); int read_nic_word(struct net_device *dev, int x, u16 *data); int write_nic_byte(struct net_device *dev, int x, u8 y); int write_nic_byte_E(struct net_device *dev, int x, u8 y); -void write_nic_word(struct net_device *dev, int x, u16 y); +int write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 4c6d444..9303715 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -329,7 +329,7 @@ int write_nic_byte(struct net_device *dev, int indx, u8 data) } -void write_nic_word(struct net_device *dev, int indx, u16 data) +int write_nic_word(struct net_device *dev, int indx, u16 data) { int status; @@ -339,7 +339,7 @@ void write_nic_word(struct net_device *dev, int indx, u16 data) u16 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -348,9 +348,12 @@ void write_nic_word(struct net_device *dev, int indx, u16 data) usbdata, 2, HZ / 2); kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_word TimeOut! status: %d\n", status); + return status; + } + return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: dgnc: fix camelcase of SerialDriver and
Signed-off-by: Daeseok Youn --- drivers/staging/dgnc/dgnc_driver.h | 4 +- drivers/staging/dgnc/dgnc_tty.c| 118 ++--- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index e4be81b..953c891 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -202,9 +202,9 @@ struct dgnc_board { * to our channels. */ - struct tty_driver SerialDriver; + struct tty_driver serial_driver; charSerialName[200]; - struct tty_driver PrintDriver; + struct tty_driver print_driver; charPrintName[200]; booldgnc_Major_Serial_Registered; diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index f33c3b5..51251ef 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -178,20 +178,20 @@ int dgnc_tty_register(struct dgnc_board *brd) { int rc = 0; - brd->SerialDriver.magic = TTY_DRIVER_MAGIC; + brd->serial_driver.magic = TTY_DRIVER_MAGIC; snprintf(brd->SerialName, MAXTTYNAMELEN, "tty_dgnc_%d_", brd->boardnum); - brd->SerialDriver.name = brd->SerialName; - brd->SerialDriver.name_base = 0; - brd->SerialDriver.major = 0; - brd->SerialDriver.minor_start = 0; - brd->SerialDriver.num = brd->maxports; - brd->SerialDriver.type = TTY_DRIVER_TYPE_SERIAL; - brd->SerialDriver.subtype = SERIAL_TYPE_NORMAL; - brd->SerialDriver.init_termios = DgncDefaultTermios; - brd->SerialDriver.driver_name = DRVSTR; - brd->SerialDriver.flags = (TTY_DRIVER_REAL_RAW | + brd->serial_driver.name = brd->SerialName; + brd->serial_driver.name_base = 0; + brd->serial_driver.major = 0; + brd->serial_driver.minor_start = 0; + brd->serial_driver.num = brd->maxports; + brd->serial_driver.type = TTY_DRIVER_TYPE_SERIAL; + brd->serial_driver.subtype = SERIAL_TYPE_NORMAL; + brd->serial_driver.init_termios = DgncDefaultTermios; + brd->serial_driver.driver_name = DRVSTR; + brd->serial_driver.flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_HARDWARE_BREAK); @@ -199,28 +199,28 @@ int dgnc_tty_register(struct dgnc_board *brd) * The kernel wants space to store pointers to * tty_struct's and termios's. */ - brd->SerialDriver.ttys = kcalloc(brd->maxports, -sizeof(*brd->SerialDriver.ttys), + brd->serial_driver.ttys = kcalloc(brd->maxports, +sizeof(*brd->serial_driver.ttys), GFP_KERNEL); - if (!brd->SerialDriver.ttys) + if (!brd->serial_driver.ttys) return -ENOMEM; - kref_init(&brd->SerialDriver.kref); - brd->SerialDriver.termios = kcalloc(brd->maxports, - sizeof(*brd->SerialDriver.termios), + kref_init(&brd->serial_driver.kref); + brd->serial_driver.termios = kcalloc(brd->maxports, + sizeof(*brd->serial_driver.termios), GFP_KERNEL); - if (!brd->SerialDriver.termios) + if (!brd->serial_driver.termios) return -ENOMEM; /* * Entry points for driver. Called by the kernel from * tty_io.c and n_tty.c. */ - tty_set_operations(&brd->SerialDriver, &dgnc_tty_ops); + tty_set_operations(&brd->serial_driver, &dgnc_tty_ops); if (!brd->dgnc_Major_Serial_Registered) { /* Register tty devices */ - rc = tty_register_driver(&brd->SerialDriver); + rc = tty_register_driver(&brd->serial_driver); if (rc < 0) { dev_dbg(&brd->pdev->dev, "Can't register tty device (%d)\n", rc); @@ -234,19 +234,19 @@ int dgnc_tty_register(struct dgnc_board *brd) * again, separately so we don't get the LD confused about what major * we are when we get into the dgnc_tty_open() routine. */ - brd->PrintDriver.magic = TTY_DRIVER_MAGIC; + brd->print_driver.magic = TTY_DRIVER_MAGIC; snprintf(brd->PrintName, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum); - brd->PrintDriver.name = brd->PrintName; - brd->PrintDriver.name_base = 0; - brd->PrintDriver.major = brd->SerialDriver.major; - brd->PrintDriver.minor_start = 0x80; - brd->PrintDriver.num = brd->maxports; - brd->PrintDriver.type = TTY_DRIVER_TYPE_SERIAL; - brd->PrintDriver.subtype = SERIAL_TYPE_NORMAL; - br
[PATCH 3/3] staging: dgnc: use tty_alloc_driver instead of kcalloc
the tty_alloc_driver() can allocate memory for ttys and termios. And also it can release allocated memory easly with using put_tty_driver(). Signed-off-by: Daeseok Youn --- drivers/staging/dgnc/dgnc_tty.c | 86 +++-- 1 file changed, 31 insertions(+), 55 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 4e4efa2..118936b 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -176,9 +176,15 @@ int dgnc_tty_preinit(void) */ int dgnc_tty_register(struct dgnc_board *brd) { - int rc = 0; + int rc; + + brd->serial_driver = tty_alloc_driver(brd->maxports, + TTY_DRIVER_REAL_RAW | + TTY_DRIVER_DYNAMIC_DEV | + TTY_DRIVER_HARDWARE_BREAK); - brd->serial_driver->magic = TTY_DRIVER_MAGIC; + if (IS_ERR(brd->serial_driver)) + return PTR_ERR(brd->serial_driver); snprintf(brd->SerialName, MAXTTYNAMELEN, "tty_dgnc_%d_", brd->boardnum); @@ -186,31 +192,10 @@ int dgnc_tty_register(struct dgnc_board *brd) brd->serial_driver->name_base = 0; brd->serial_driver->major = 0; brd->serial_driver->minor_start = 0; - brd->serial_driver->num = brd->maxports; brd->serial_driver->type = TTY_DRIVER_TYPE_SERIAL; brd->serial_driver->subtype = SERIAL_TYPE_NORMAL; brd->serial_driver->init_termios = DgncDefaultTermios; brd->serial_driver->driver_name = DRVSTR; - brd->serial_driver->flags = (TTY_DRIVER_REAL_RAW | - TTY_DRIVER_DYNAMIC_DEV | - TTY_DRIVER_HARDWARE_BREAK); - - /* -* The kernel wants space to store pointers to -* tty_struct's and termios's. -*/ - brd->serial_driver->ttys = kcalloc(brd->maxports, -sizeof(*brd->serial_driver->ttys), -GFP_KERNEL); - if (!brd->serial_driver->ttys) - return -ENOMEM; - - kref_init(&brd->serial_driver->kref); - brd->serial_driver->termios = kcalloc(brd->maxports, - sizeof(*brd->serial_driver->termios), - GFP_KERNEL); - if (!brd->serial_driver->termios) - return -ENOMEM; /* * Entry points for driver. Called by the kernel from @@ -224,7 +209,7 @@ int dgnc_tty_register(struct dgnc_board *brd) if (rc < 0) { dev_dbg(&brd->pdev->dev, "Can't register tty device (%d)\n", rc); - return rc; + goto free_serial_driver; } brd->dgnc_Major_Serial_Registered = true; } @@ -234,38 +219,26 @@ int dgnc_tty_register(struct dgnc_board *brd) * again, separately so we don't get the LD confused about what major * we are when we get into the dgnc_tty_open() routine. */ - brd->print_driver->magic = TTY_DRIVER_MAGIC; + brd->print_driver = tty_alloc_driver(brd->maxports, +TTY_DRIVER_REAL_RAW | +TTY_DRIVER_DYNAMIC_DEV | +TTY_DRIVER_HARDWARE_BREAK); + + if (IS_ERR(brd->print_driver)) { + rc = PTR_ERR(brd->print_driver); + goto unregister_serial_driver; + } + snprintf(brd->PrintName, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum); brd->print_driver->name = brd->PrintName; brd->print_driver->name_base = 0; brd->print_driver->major = brd->serial_driver->major; brd->print_driver->minor_start = 0x80; - brd->print_driver->num = brd->maxports; brd->print_driver->type = TTY_DRIVER_TYPE_SERIAL; brd->print_driver->subtype = SERIAL_TYPE_NORMAL; brd->print_driver->init_termios = DgncDefaultTermios; brd->print_driver->driver_name = DRVSTR; - brd->print_driver->flags = (TTY_DRIVER_REAL_RAW | - TTY_DRIVER_DYNAMIC_DEV | - TTY_DRIVER_HARDWARE_BREAK); - - /* -* The kernel wants space to store pointers to -* tty_struct's and termios's. Must be separated from -* the Serial Driver so we don't get confused -*/ - brd->print_driver->ttys = kcalloc(brd->maxports, - sizeof(*brd->print_driver->ttys), - GFP_KERNEL); - if (!brd->print_driver->ttys) - return -ENOMEM; - kref_init(&brd->print_driver->kref); - brd->print_driver->termios = kcalloc(brd->maxports, - sizeof(*
[PATCH 2/3] staging: dgnc: use pointer type of tty_struct
For using tty_alloc_driver, SerialDriver has to be pointer type. It also has checkpatch.pl warning about Camelcase, so SerialDriver is changed to serial_driver. Signed-off-by: Daeseok Youn --- drivers/staging/dgnc/dgnc_driver.h | 4 +- drivers/staging/dgnc/dgnc_tty.c| 118 ++--- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 953c891..15abe15 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -202,9 +202,9 @@ struct dgnc_board { * to our channels. */ - struct tty_driver serial_driver; + struct tty_driver *serial_driver; charSerialName[200]; - struct tty_driver print_driver; + struct tty_driver *print_driver; charPrintName[200]; booldgnc_Major_Serial_Registered; diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 51251ef..4e4efa2 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -178,20 +178,20 @@ int dgnc_tty_register(struct dgnc_board *brd) { int rc = 0; - brd->serial_driver.magic = TTY_DRIVER_MAGIC; + brd->serial_driver->magic = TTY_DRIVER_MAGIC; snprintf(brd->SerialName, MAXTTYNAMELEN, "tty_dgnc_%d_", brd->boardnum); - brd->serial_driver.name = brd->SerialName; - brd->serial_driver.name_base = 0; - brd->serial_driver.major = 0; - brd->serial_driver.minor_start = 0; - brd->serial_driver.num = brd->maxports; - brd->serial_driver.type = TTY_DRIVER_TYPE_SERIAL; - brd->serial_driver.subtype = SERIAL_TYPE_NORMAL; - brd->serial_driver.init_termios = DgncDefaultTermios; - brd->serial_driver.driver_name = DRVSTR; - brd->serial_driver.flags = (TTY_DRIVER_REAL_RAW | + brd->serial_driver->name = brd->SerialName; + brd->serial_driver->name_base = 0; + brd->serial_driver->major = 0; + brd->serial_driver->minor_start = 0; + brd->serial_driver->num = brd->maxports; + brd->serial_driver->type = TTY_DRIVER_TYPE_SERIAL; + brd->serial_driver->subtype = SERIAL_TYPE_NORMAL; + brd->serial_driver->init_termios = DgncDefaultTermios; + brd->serial_driver->driver_name = DRVSTR; + brd->serial_driver->flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_HARDWARE_BREAK); @@ -199,28 +199,28 @@ int dgnc_tty_register(struct dgnc_board *brd) * The kernel wants space to store pointers to * tty_struct's and termios's. */ - brd->serial_driver.ttys = kcalloc(brd->maxports, -sizeof(*brd->serial_driver.ttys), + brd->serial_driver->ttys = kcalloc(brd->maxports, +sizeof(*brd->serial_driver->ttys), GFP_KERNEL); - if (!brd->serial_driver.ttys) + if (!brd->serial_driver->ttys) return -ENOMEM; - kref_init(&brd->serial_driver.kref); - brd->serial_driver.termios = kcalloc(brd->maxports, - sizeof(*brd->serial_driver.termios), + kref_init(&brd->serial_driver->kref); + brd->serial_driver->termios = kcalloc(brd->maxports, + sizeof(*brd->serial_driver->termios), GFP_KERNEL); - if (!brd->serial_driver.termios) + if (!brd->serial_driver->termios) return -ENOMEM; /* * Entry points for driver. Called by the kernel from * tty_io.c and n_tty.c. */ - tty_set_operations(&brd->serial_driver, &dgnc_tty_ops); + tty_set_operations(brd->serial_driver, &dgnc_tty_ops); if (!brd->dgnc_Major_Serial_Registered) { /* Register tty devices */ - rc = tty_register_driver(&brd->serial_driver); + rc = tty_register_driver(brd->serial_driver); if (rc < 0) { dev_dbg(&brd->pdev->dev, "Can't register tty device (%d)\n", rc); @@ -234,19 +234,19 @@ int dgnc_tty_register(struct dgnc_board *brd) * again, separately so we don't get the LD confused about what major * we are when we get into the dgnc_tty_open() routine. */ - brd->print_driver.magic = TTY_DRIVER_MAGIC; + brd->print_driver->magic = TTY_DRIVER_MAGIC; snprintf(brd->PrintName, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum); - brd->print_driver.name = brd->PrintName; - brd->print_driver.name_base = 0; - brd->print_driver.major = brd->serial_driver.major; - brd->pr
Re: [PATCH V2 1/9] staging: rtl8192u: check return value of read_nic_word_E
Hi Salah, [auto build test WARNING on staging/staging-testing] [also build test WARNING on v4.5 next-20160311] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Salah-Triki/staging-rtl8192u-Checking-return-value-propagating-errors/20160314-115621 config: i386-randconfig-c0-03141212 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/staging/rtl8192u/r8180_93cx6.c: In function 'eprom_read': >> drivers/staging/rtl8192u/r8180_93cx6.c:159:7: warning: 'ret' may be used >> uninitialized in this function [-Wmaybe-uninitialized] ret |= (eprom_r(dev) << (15 - i)); ^ vim +/ret +159 drivers/staging/rtl8192u/r8180_93cx6.c 8fc8598e Jerry Chuang 2009-11-03 143 eprom_cs(dev, 1); 8fc8598e Jerry Chuang 2009-11-03 144 eprom_ck_cycle(dev); 8fc8598e Jerry Chuang 2009-11-03 145 eprom_send_bits_string(dev, read_cmd, 3); 8fc8598e Jerry Chuang 2009-11-03 146 eprom_send_bits_string(dev, addr_str, addr_len); 8fc8598e Jerry Chuang 2009-11-03 147 2ad99c50 Sanjeev Sharma 2014-07-31 148 /* 2ad99c50 Sanjeev Sharma 2014-07-31 149 * keep chip pin D to low state while reading. 2ad99c50 Sanjeev Sharma 2014-07-31 150 * I'm unsure if it is necessary, but anyway shouldn't hurt 2ad99c50 Sanjeev Sharma 2014-07-31 151 */ 8fc8598e Jerry Chuang 2009-11-03 152 eprom_w(dev, 0); 8fc8598e Jerry Chuang 2009-11-03 153 8fc8598e Jerry Chuang 2009-11-03 154 for (i = 0; i < 16; i++) { 2ad99c50 Sanjeev Sharma 2014-07-31 155 /* eeprom needs a clk cycle between writing opcode&adr 2ad99c50 Sanjeev Sharma 2014-07-31 156 * and reading data. (eeprom outs a dummy 0) 2ad99c50 Sanjeev Sharma 2014-07-31 157 */ 8fc8598e Jerry Chuang 2009-11-03 158 eprom_ck_cycle(dev); 8fc8598e Jerry Chuang 2009-11-03 @159 ret |= (eprom_r(dev) << (15 - i)); 8fc8598e Jerry Chuang 2009-11-03 160 } 8fc8598e Jerry Chuang 2009-11-03 161 8fc8598e Jerry Chuang 2009-11-03 162 eprom_cs(dev, 0); 8fc8598e Jerry Chuang 2009-11-03 163 eprom_ck_cycle(dev); 8fc8598e Jerry Chuang 2009-11-03 164 2ad99c50 Sanjeev Sharma 2014-07-31 165 /* disable EPROM programming */ 8fc8598e Jerry Chuang 2009-11-03 166 write_nic_byte_E(dev, EPROM_CMD, 8fc8598e Jerry Chuang 2009-11-03 167 (EPROM_CMD_NORMAL< :: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Add tw5864 driver
On Mon, 2016-03-14 at 03:59 +0200, Andrey Utkin wrote: > Support for boards based on Techwell TW5864 chip which provides > multichannel video & audio grabbing and encoding (H.264, MJPEG, > ADPCM G.726). trivia: Perhaps all the __used arrays could be const ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel